9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-19 15:09:18 +00:00

fix mantle flag serialization

This commit is contained in:
Julian Krings
2025-09-03 12:56:02 +02:00
parent 176d3a5f9f
commit f63cabd8b8
2 changed files with 3 additions and 8 deletions

View File

@@ -87,8 +87,7 @@ public class MantleChunk {
int l = version < 0 ? MantleFlag.RESERVED_FLAGS : Varint.readUnsignedVarInt(din); int l = version < 0 ? MantleFlag.RESERVED_FLAGS : Varint.readUnsignedVarInt(din);
if (version >= 1) { if (version >= 1) {
int count = Math.ceilDiv(flags.length(), Byte.SIZE); for (int i = 0; i < l;) {
for (int i = 0; i < count;) {
byte f = din.readByte(); byte f = din.readByte();
for (int j = 0; j < Byte.SIZE && i < flags.length(); j++, i++) { for (int j = 0; j < Byte.SIZE && i < flags.length(); j++, i++) {
flags.set(i, (f & (1 << j)) != 0); flags.set(i, (f & (1 << j)) != 0);
@@ -267,9 +266,9 @@ public class MantleChunk {
dos.writeByte(x); dos.writeByte(x);
dos.writeByte(z); dos.writeByte(z);
dos.writeByte(sections.length()); dos.writeByte(sections.length());
Varint.writeUnsignedVarInt(flags.length(), dos); Varint.writeUnsignedVarInt(Math.ceilDiv(flags.length(), Byte.SIZE), dos);
int count = Math.ceilDiv(flags.length(), Byte.SIZE); int count = flags.length();
for (int i = 0; i < count;) { for (int i = 0; i < count;) {
int f = 0; int f = 0;
for (int j = 0; j < Byte.SIZE && i < flags.length(); j++, i++) { for (int j = 0; j < Byte.SIZE && i < flags.length(); j++, i++) {

View File

@@ -28,10 +28,6 @@ public class AtomicBooleanArray implements Serializable {
return (boolean) AA.compareAndSet(array, index, expectedValue, newValue); return (boolean) AA.compareAndSet(array, index, expectedValue, newValue);
} }
public final boolean weakCompareAndSet(int index, boolean expectedValue, boolean newValue) {
return (boolean) AA.weakCompareAndSetPlain(array, index, expectedValue, newValue);
}
@Override @Override
public String toString() { public String toString() {
int iMax = array.length - 1; int iMax = array.length - 1;