Skip to content

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