mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
Fix issues with new IR serialization format
This commit is contained in:
parent
abdd9b3270
commit
3acf1f9538
|
@ -118,7 +118,7 @@ public class ClassIO {
|
||||||
output.writeUnsigned(0);
|
output.writeUnsigned(0);
|
||||||
} else if (value instanceof Integer) {
|
} else if (value instanceof Integer) {
|
||||||
output.writeUnsigned(1);
|
output.writeUnsigned(1);
|
||||||
output.writeUnsigned((Integer) value);
|
output.writeSigned((Integer) value);
|
||||||
} else if (value instanceof Long) {
|
} else if (value instanceof Long) {
|
||||||
output.writeUnsigned(2);
|
output.writeUnsigned(2);
|
||||||
output.writeSigned((Long) value);
|
output.writeSigned((Long) value);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class VarDataInput {
|
||||||
|
|
||||||
public int readSigned() throws IOException {
|
public int readSigned() throws IOException {
|
||||||
int value = readUnsigned();
|
int value = readUnsigned();
|
||||||
return (value & 1) == 0 ? (value >>> 1) : -(value >>> 1);
|
return (value & 1) == 0 ? (value >>> 1) : ~(value >>> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long readUnsignedLong() throws IOException {
|
public long readUnsignedLong() throws IOException {
|
||||||
|
@ -65,7 +65,7 @@ public class VarDataInput {
|
||||||
|
|
||||||
public long readSignedLong() throws IOException {
|
public long readSignedLong() throws IOException {
|
||||||
long value = readUnsignedLong();
|
long value = readUnsignedLong();
|
||||||
return (value & 1) == 0 ? (value >> 1) : -(value >> 1);
|
return (value & 1) == 0 ? (value >> 1) : ~(value >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float readFloat() throws IOException {
|
public float readFloat() throws IOException {
|
||||||
|
@ -106,7 +106,7 @@ public class VarDataInput {
|
||||||
long bits = mantissa & ((1L << 52) - 1);
|
long bits = mantissa & ((1L << 52) - 1);
|
||||||
bits |= (long) exponent << 52;
|
bits |= (long) exponent << 52;
|
||||||
if (sign) {
|
if (sign) {
|
||||||
bits |= 1L << 53;
|
bits |= 1L << 63;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Double.longBitsToDouble(bits);
|
return Double.longBitsToDouble(bits);
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class VarDataOutput implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeSigned(int value) throws IOException {
|
public void writeSigned(int value) throws IOException {
|
||||||
writeUnsigned(value < 0 ? ((-value) << 1) | 1 : value << 1);
|
writeUnsigned(value < 0 ? ((~value) << 1) | 1 : value << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUnsigned(long value) throws IOException {
|
public void writeUnsigned(long value) throws IOException {
|
||||||
|
@ -49,7 +49,7 @@ public class VarDataOutput implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeSigned(long value) throws IOException {
|
public void writeSigned(long value) throws IOException {
|
||||||
writeUnsigned(value < 0 ? ((-value) << 1) | 1 : value << 1);
|
writeUnsigned(value < 0 ? ((~value) << 1) | 1 : value << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeFloat(float value) throws IOException {
|
public void writeFloat(float value) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user