Commit a9b2120f by Lei YU

Fix an issue in BitArray.readUnsignedByte() returns incorrect value when…

Fix an issue in BitArray.readUnsignedByte() returns incorrect value when bitOffset is not zero and data[byteOffset + 1] starts with bit 1.
This is caused by signed right shift, the fix is simply to make it unsigned right shift.
parent b30f55f1
......@@ -151,7 +151,7 @@ public final class BitArray {
byte b;
if (bitOffset != 0) {
b = (byte) ((data[byteOffset] << bitOffset)
| (data[byteOffset + 1] >> (8 - bitOffset)));
| ((data[byteOffset + 1] & 0xFF) >> (8 - bitOffset)));
} else {
b = data[byteOffset];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment