bit-array icon indicating copy to clipboard operation
bit-array copied to clipboard

Extending values array beyond the initialized length does not set values to zeroes

Open a701440 opened this issue 12 years ago • 2 comments

vat bits = new BitArray(); bits.set(6000,true); bits.toJSON();

a701440 avatar Mar 12 '13 14:03 a701440

This is on purpose. I needed to transfer the JSON representation over the wire and left out anything that wasn't defined. (Assuming the receiving end knows about this convention.)

bramstein avatar Mar 13 '13 09:03 bramstein

Setting one bit in a 32 bit value sets them all, so it's not really possible to detect what bits were set and which were not consistently and "null" takes more characters on the wire than "0".

a701440 avatar Mar 13 '13 13:03 a701440