tdegrunt / bitset Goto Github PK
View Code? Open in Web Editor NEWdeprecated - check out https://github.com/infusion/BitSet.js instead!
deprecated - check out https://github.com/infusion/BitSet.js instead!
Hi! I'd love to be able to use this tool in one of my projects but no license is attached. If you'd consider adding one, I'd appreciate that greatly. Thank you!
Hello,
How "long" so to speak can the bitset be? I am considering a leap into JavaScript, React, Node, etc, and along with that, will need some sort of extensible bitset. Should be able to support arbitrary length bitsets, complete with bitwise operations, serialization to/from string, bit as well as hex or even base-n representation. Serialization might be pushing it, but it does need to be extensible. Wondering if this is that?
Thank you...
Hey,
Thanks for sharing this code, really helpful! Just a quick observation about the andNot method.
This function fails to pass the following test:
bitSet = new BitSet();
BitSet bs = bitSet;
for (int i = 0; i <= 7; i++) {
bitSet.set(i);
}
bs.clear(5);
BitSet bs2 = new BitSet();
bs2.set(2);
bs2.set(3);
bs.andNot(bs2);
assertEquals("Incorrect bitset after andNot",
"{0, 1, 4, 6, 7}", bs.toString());
bs = new BitSet(0);
bs.andNot(bs2);
assertEquals("Incorrect size", 0, bs.length());
Fails assertion with "incorrect bitset after andNot", I see "{0,1,2,3,4,6,7}" instead of "{0, 1, 4, 6, 7}"
I have moved to using this implementation as well : https://github.com/atonparker/bitterset
http://requirebin.com/?gist=3a6e57bacfbfeb34a66d
var BitSet = require("bitset");
var s = new BitSet();
for (var i = 0; i <= 13; i++) {
s.set(i);
}
s.get(0); // true, as expected.
s.clear(0);
s.get(0); // true, not good!
The version that gets installed when typing npm install bitset
(0.3.0) is broken. I had to type npm install tdegrunt/bitset
to get a working distribution.
Should be a matter of git tag 0.4.0
and npm publish
...
clear: (pos) ->
@store[@wordIndex(pos)] &= (0xFF ^ (1 << pos))
code should be
clear: (pos) ->
@store[@wordIndex(pos)] &= (-1 ^ (1 << pos))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.