rust-lang / rust-lang/hashbrown
Explain Bitwise hack
Open
@ThatSealgair is already working on this.
Since Oct 3, 2022.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 358
- Avg merge
- 11h 57m
- Merged PRs (30d)
- 2
Description
It took me watching this part of a video and reading this article to figure out the bitwise operation is just acting as a pseudo modulus exploiting the fact that n % x = n & (x -1) where n = (2^i - 1) and i is a non-negative integer. Perhaps add a note for anybody else who finds themself in the same rabbit-hole to save them time.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.