Yes, bits are usually numbered from right to left,while single bytes are usually visualized from left to right,that’s the origin of confusion in my case.
If it’s of any help to you, think in these terms: the current implementation of getBitRange returns bits numbered as if the whole binary content of the block was a little endian integer stored in memory, with least significant bytes in the lowest locations (here represented by the first elements of the block).
This is of little help in case you are doing stream operations on the single bits though. In that case, I’d like bit 0 to be the “leftmost” of the first byte (byte 0), bit 7 would be the rightmost of the same byte, bit 8 the leftmost of byte 1, bit 15 the rightmost of byte 1 and so on… what do you think about adding a second getBitRange-like method that follows this order?
Would others in this thread find it useful too?