Correctly handle reading 0 bits
This commit is contained in:
parent
85445536c3
commit
9c2528a70f
@ -155,6 +155,9 @@ public final class ParsableBitArray {
|
|||||||
* @return An integer whose bottom n bits hold the read data.
|
* @return An integer whose bottom n bits hold the read data.
|
||||||
*/
|
*/
|
||||||
public int readBits(int numBits) {
|
public int readBits(int numBits) {
|
||||||
|
if (numBits == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int returnValue = 0;
|
int returnValue = 0;
|
||||||
bitOffset += numBits;
|
bitOffset += numBits;
|
||||||
while (bitOffset > 8) {
|
while (bitOffset > 8) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user