use bitwise or instead of addition when reconsituting long

This commit is contained in:
Alec Grieser 2019-03-11 18:26:08 -07:00
parent 7340298202
commit d9e9e0c521
No known key found for this signature in database
GPG Key ID: CAF63551C60D3462
1 changed files with 2 additions and 2 deletions

View File

@ -509,14 +509,14 @@ class TupleUtil {
if(positive && (n < Long.BYTES || rep[start] > 0)) {
long res = 0L;
for(int i = start; i < end; i++) {
res = (res << 8) + (rep[i] & 0xff);
res = (res << 8) | (rep[i] & 0xff);
}
state.add(res, end);
}
else if(!positive && (n < Long.BYTES || rep[start] < 0)) {
long res = ~0L;
for(int i = start; i < end; i++) {
res = (res << 8) + (rep[i] & 0xff);
res = (res << 8) | (rep[i] & 0xff);
}
state.add(res + 1, end);
}