A BitSet for Node.js more like java.util.BitSet


I tried https://github.com/tdegrunt/bitset, it’s a nice CoffeeScript implementation, but there’re a few things I don’t get, for one, its position starts from 1, not 0. If that could be overcomed, there’s the poor #cardinality implementation, which really iterates every bit to sum it up. The last straw was the fact that #nextSetBit was completely missing.

https://github.com/bramstein/bit-array has a much better cardinality implementation, but it doesn’t provide #nextSetBit either, and the real headache was that “and”, “or”, “xor” operations all require the inner words array to have identical length.

That does it, I’ll have to get a BitSet works better than that, if not better than java.util.BitSet


Not much to brag about, just an attempt to ease my node.js development, that could perform a faster cardinality & could give a nextSetBit api. Yet fully tested though.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s