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

Add fn replace_aliased(&self, usize, bool) -> bool to BitSlice<T, O> #284

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

regexident
Copy link

This PR adds the following methods to BitSlice<T, O>:

  • fn replace_aliased(&self, usize, bool) -> bool
  • fn replace_aliased_unchecked(&self, usize, bool) -> bool

They are modeled after the existing fn set_aliased()/fn set_aliased_unchecked() methods on BitSlice<T, O>.

The motivation behind these methods is to be able to use BitVec<AtomicUsize> for keeping track of "visited" nodes in a parallel graph traversal without the need of locking. As such you often need to atomically add a node to the "visited" set, while also find out if it had already been visited before (e.g. for avoiding performing redundant computations).

…iased_unchecked(…) -> bool` to `BitSlice<T, O>`
@regexident
Copy link
Author

Just noticed this other PR that sort of aims to achieve the same: #273

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

Successfully merging this pull request may close these issues.

1 participant