-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
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
Add is_clear method #79
Conversation
Thanks. Can you please add some tests for this function? |
Thank for the review! Very important to keep thing names consistent in documentation. I indeed picked up "element" by just looking at the iterator methods. I'll fix that. A question: the docs use both "enabled/disabled" and "set/unset" for value = 1/0. You seem to prefer "set/unset", and I'll follow this preference, but I prefer "enabled/disabled" since "set" can also mean a set of values. |
I'm very happy with the second pass on the docs. Although, in insight, I'm a bit skittish about both updating the doc on |
"enabled/disabled" is ok. Using "bit" instead of element is more important. Don't worry about updating the doc on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! As a final step, could you please add some test for is_clear()
?
Thank you for the directions and the merge! Was the doc example code enough test? |
When using this library, the intent of checking if all elements in a bitset are disabled is better expressed with a specialized method. I doubt it's particularly more performant than
bitset.count_ones(..) == 0
, but when reading code usingFixedBitSet
, it's easier to understand what is going on with abitset.is_clear()
than abitset.count_ones(..) == 0
.I also added docs so that it's less easy to get confused as to what "empty" means (I think the confusion was raised multiple times in the past)