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

Support ShiftLeft and ShiftRight #165

Merged
merged 7 commits into from
Aug 23, 2024
Merged

Conversation

skullhole
Copy link
Contributor

@skullhole skullhole commented Aug 23, 2024

Description

Addresses #144

Implementation notes

  • Introduces unused leadingZeroes64() as well as len64(). I am open to removing it if maintainer(s) request that. I believe though it may be useful in future if golang 1.8 support is not dropped. I have not tested len64() for older versions very thoroughly so any assistance is appreciated.
  • top() (uint, bool) method might be what was requested in get top bit set? #86 . I did not export it because I'd expect it to accept argument and behave as reversed NextSet(i uint) (uint, bool).

@skullhole skullhole marked this pull request as ready for review August 23, 2024 16:32

package bitset

var len8tab = "" +
Copy link
Member

@lemire lemire Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding a quick test? Like...

for k:= 0; k < 64; ++) {
  if len64(uint64(1)<<k) != k+1 {
    // error!
  }
}

@lemire
Copy link
Member

lemire commented Aug 23, 2024

Looks good to me. Consider adding a sanity test for len64.

@lemire
Copy link
Member

lemire commented Aug 23, 2024

Ok. I am merging and releasing.

@lemire lemire merged commit 12944a5 into bits-and-blooms:master Aug 23, 2024
15 checks passed
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.

2 participants