bramstein / bit-array

JavaScript implementation of bit arrays.
78 stars 18 forks source link

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

Open a701440 opened 11 years ago

a701440 commented 11 years ago

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

bramstein commented 11 years ago

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.)

a701440 commented 11 years ago

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".