No BitArray.getRange()?


Seems like I must be missing something. There is a setRange(), and a getBitRangeAsInt(), but apparently no general getBitRange(startBit, numBits) that returns a new BitArray.

I’m also surprised that there doesn’t seem to be a getSize() either. Can I distinguish between a BitArray initialized to 0x1 and one initialized to 0x10000000000000000000?


Yeah, that is a bit of an ommission. I’ll add one.

There’s a getHighestBit method, which is a better description of what it does than getSize would have been.


Still confused. Perhaps my bit array abstraction is off base. I would expect to be able to create a 16 bit array of 0s such that array.getSize() returns 16. Won’t the current getHighestBit() return -1 in this case? Do Juce BitArrays distinguish between zero filled arrays and empty arrays?


No, these are more like a big binary number. (I’ve considered changing the class name to BigInteger or something, but that’d involve a lot of find+replacing).