BitBuffer
BitBuffer copied to clipboard
[BUG] BitBuffer .put and .get methods with arrays have inverted condition on for loop
As an example, there is the following code on BitBuffer abstract class convenience method for putting boolean arrays:
public BitBuffer put(boolean[] array) {
put(array, 0, array.length);
return this;
}
Which int turn invokes method:
public BitBuffer put(boolean[] array, int offset, int limit) {
for(; offset > limit; ++offset) {
put(array[offset]);
}
return this;
}
However when invoked the method always skip the for, because the condition is inverted: offset (initial 0) is always <= limit when entering the method!
This is repeated on all instances of such methods, just swapping offset > limit for offset < limit should do the trick!