Skip to content

Commit 1e88210

Browse files
committed
umb: Bugfix in UMBBitString sign extensions.
1 parent 9ae8999 commit 1e88210

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

prism/src/io/github/pmctools/umbj/UMBBitString.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public long getLong(int offset, int n) throws UMBException
202202
value = (value << 1) | ((bytes[i >> 3] & (1L << (i & 7))) != 0 ? 1 : 0);
203203
}
204204
// Sign extend if necessary
205-
if ((value & (1 << (n - 1))) != 0) {
206-
value -= (1 << n);
205+
if (n < 64 && (value & (1L << (n - 1))) != 0) {
206+
value -= (1L << n);
207207
}
208208
return value;
209209
}

0 commit comments

Comments
 (0)