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 my own dynamically sized bitset. #120

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Conversation

Possseidon
Copy link
Owner

I tried using boost::dynamic_bitset, but it has a few issues with my specific use-cases...

So I'll just roll my own and make it ✨ super fancy ✨ as per usual!

There's some commits in this PR that I should probably cherry pick into some other branches.

Issues with boost::dynamic_bitset

  1. Applying logical operations requires bitsets to be of the same size for no good reason.
    ... which means, I have to allocate if I want to compare efficiently. Or I skip the resizing and compare manually but super slow..
  2. Comparisons are very odd and don't mimic the correct behavior of standard containers like std::vector<bool>.
    bitset[0] should be the most significant bit, yet bitset[word_bits - 1] seems to be the most significant.
  3. No way of finding the last set bit.
    Didn't really need it yet, but might come in handy at some point. Still dumb that it's missing.
  4. Brings in quite a bit of other boost stuff just for a bitset.
    Also, there's no CMake targets because it's header only... Ever heared of INTERFACE targets? sigh

So yeah... Reinventing the wheel once again!

@Possseidon Possseidon added enhancement New feature or request dang-utils labels Jun 26, 2022
@Possseidon Possseidon self-assigned this Jun 26, 2022
@Possseidon Possseidon force-pushed the dev/bitset branch 2 times, most recently from ece8de0 to 38f06e7 Compare July 1, 2022 20:57
@Possseidon Possseidon marked this pull request as draft July 1, 2022 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dang-utils enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant