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

Get Nat as sequence of bits (and construct from bits) #121

Open
saxbophone opened this issue Jun 10, 2022 · 1 comment
Open

Get Nat as sequence of bits (and construct from bits) #121

saxbophone opened this issue Jun 10, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@saxbophone
Copy link
Owner

saxbophone commented Jun 10, 2022

constexpr codlili::List<bool> Nat::bits() const;

constexpr Nat::Nat(const codlili::List<bool>& bits);

template <std::size_t N>
constexpr Nat::Nat(const std::bitset<N>& bits);

We can use std::bitset to take a shortcut when converting to bits (make a bitset for each digit and read bits out of them in sequence).

Related to #83, #114

@saxbophone saxbophone added the enhancement New feature or request label Jun 10, 2022
@saxbophone saxbophone modified the milestone: v0.5 Jun 10, 2022
@saxbophone
Copy link
Owner Author

Dropped from v0.5 milestone —if we're going to read bits, we should probably support writing them (via ctor) too, that is too much work for the meagre benefit right now.

@saxbophone saxbophone changed the title Get Nat as sequence of bits Get Nat as sequence of bits (and construct from bits) Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant