Skip to content

[BUG] BitBuffer .put and .get methods with arrays have inverted condition on for loop #11

Description

@henry701

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions