mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Merge pull request #260 from mine260309/dev-hls
Fix a signed right shift issue in BitArray.readUnsignedByte()
This commit is contained in:
commit
06ddb036c8
1 changed files with 5 additions and 6 deletions
|
|
@ -148,16 +148,15 @@ public final class BitArray {
|
|||
* @return The value of the parsed byte.
|
||||
*/
|
||||
public int readUnsignedByte() {
|
||||
byte b;
|
||||
int value;
|
||||
if (bitOffset != 0) {
|
||||
b = (byte) ((data[byteOffset] << bitOffset)
|
||||
| (data[byteOffset + 1] >> (8 - bitOffset)));
|
||||
value = (data[byteOffset] << bitOffset)
|
||||
| ((data[byteOffset + 1] & 0xFF) >>> (8 - bitOffset));
|
||||
} else {
|
||||
b = data[byteOffset];
|
||||
value = data[byteOffset];
|
||||
}
|
||||
byteOffset++;
|
||||
// Converting a signed byte into unsigned.
|
||||
return b & 0xFF;
|
||||
return value & 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue