Merge pull request #2723 from ajbeamon/java-fix-little-endian-unpack

Fix: Java directory layer was unpacking little endian numbers without properly handling signs
This commit is contained in:
A.J. Beamon 2020-02-21 17:43:25 -08:00 committed by GitHub
commit 6a6b89b258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -817,9 +817,9 @@ public class DirectoryLayer implements Directory {
private static long unpackLittleEndian(byte[] bytes) {
assert bytes.length == 8;
int value = 0;
long value = 0;
for(int i = 0; i < 8; ++i) {
value += (bytes[i] << (i * 8));
value += (Byte.toUnsignedLong(bytes[i]) << (i * 8));
}
return value;
}