We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you have a Bitset of size 64, you get an incorrect cardinality value (always 0).
bits = Bitset.new(64) bits.set(13,23) puts bits.cardinality
Results in the value of 0, when it should be 2.
The text was updated successfully, but these errors were encountered:
This occurs with all Bitsets that have sizes that are multiples of 64. Bits set in the final word will not be counted.
For example:
a = Bitset.new(128) a[65] = 1 a.cardinality #= prints 0
Error down to this line:
if(i+1 == max) segment &= ((((uint64_t) 1) << (bs->len & 0x3F)) - 1)
Substituting bs->len for any multiple of 64 results in segment &= 0
segment &= 0
This is a bit beyond my comfort zone. I'd suggest a modulo check, but the source looks like it's geared for speed.
Sorry, something went wrong.
Perhaps if(i+1 == max && (bs->len & 0x3F)) ?
if(i+1 == max && (bs->len & 0x3F))
I'm closing this issue as a great deal of time has passed. If there is renewed interest just reopen or make a new issue and link to this one.
No branches or pull requests
If you have a Bitset of size 64, you get an incorrect cardinality value (always 0).
Results in the value of 0, when it should be 2.
The text was updated successfully, but these errors were encountered: