mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-08 03:40:27 +01:00
Inline modulo
This commit is contained in:
parent
b4b6c333bf
commit
482db79378
@ -68,12 +68,9 @@ final class PaletteImpl implements Palette, Cloneable {
|
|||||||
// Section is not loaded, return default value
|
// Section is not loaded, return default value
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
x %= dimension;
|
|
||||||
y %= dimension;
|
|
||||||
z %= dimension;
|
|
||||||
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
||||||
|
|
||||||
final int sectionIdentifier = getSectionIndex(x, y, z);
|
final int sectionIdentifier = getSectionIndex(x % dimension, y % dimension, z % dimension);
|
||||||
final int index = sectionIdentifier / valuesPerLong;
|
final int index = sectionIdentifier / valuesPerLong;
|
||||||
final int bitIndex = sectionIdentifier % valuesPerLong * bitsPerEntry;
|
final int bitIndex = sectionIdentifier % valuesPerLong * bitsPerEntry;
|
||||||
final short value = (short) (values[index] >> bitIndex & MAGIC_MASKS[bitsPerEntry]);
|
final short value = (short) (values[index] >> bitIndex & MAGIC_MASKS[bitsPerEntry]);
|
||||||
@ -96,13 +93,10 @@ final class PaletteImpl implements Palette, Cloneable {
|
|||||||
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
||||||
this.values = new long[(size + valuesPerLong - 1) / valuesPerLong];
|
this.values = new long[(size + valuesPerLong - 1) / valuesPerLong];
|
||||||
}
|
}
|
||||||
x %= dimension;
|
|
||||||
y %= dimension;
|
|
||||||
z %= dimension;
|
|
||||||
// Change to palette value
|
// Change to palette value
|
||||||
value = getPaletteIndex(value);
|
value = getPaletteIndex(value);
|
||||||
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
||||||
final int sectionIndex = getSectionIndex(x, y, z);
|
final int sectionIndex = getSectionIndex(x % dimension, y % dimension, z % dimension);
|
||||||
final int index = sectionIndex / valuesPerLong;
|
final int index = sectionIndex / valuesPerLong;
|
||||||
final int bitIndex = (sectionIndex % valuesPerLong) * bitsPerEntry;
|
final int bitIndex = (sectionIndex % valuesPerLong) * bitsPerEntry;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user