Skip to content
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

Implement the BitSet API #83

Closed
arucil opened this issue Oct 16, 2020 · 1 comment
Closed

Implement the BitSet API #83

arucil opened this issue Oct 16, 2020 · 1 comment

Comments

@arucil
Copy link

arucil commented Oct 16, 2020

The following set operations are what I can think of currently.

iter_ones
set difference
collect::<BitSet>() from an iterator of usize's
@arucil arucil changed the title Implement iter_ones() for BitSlice Implement the BitSet API Oct 16, 2020
myrrlyn added a commit that referenced this issue Oct 17, 2020
@myrrlyn
Copy link
Collaborator

myrrlyn commented Oct 17, 2020

The difference between two slices can be computed with the ^ or ^= operators. At present, these are shims over

use bitvec::prelude::*;

let a = bits![mut 0, 0, 1, 1];
let b = bits![0, 1, 0, 1];

for (mut a, b) in a.iter_mut().zip(b.iter().copied()) {
  *a ^= b;
}

as I have not yet implemented specialization for batch comparison.

The FromIterator<T> implementation, as well as the .iter_ones() and .iter_zeros() methods, will be available in the next release.

If you have any other requests, please feel free to reöpen this issue.

@myrrlyn myrrlyn closed this as completed Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants