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

Migrate to the bitvec crate for bit iterators #30

Merged
merged 5 commits into from
Sep 4, 2020
Merged

Migrate to the bitvec crate for bit iterators #30

merged 5 commits into from
Sep 4, 2020

Conversation

str4d
Copy link
Member

@str4d str4d commented Sep 2, 2020

The Endianness trait, PrimeField::ReprEndianness associated type, and BitIterator struct are all removed.

The MSRV is now 1.44.0, matching the bitvec crate.

The PrimeField::ReprBits associated type is used to specify the backing
array used by bitvec's BitArray struct. Once const-generics stabilise,
the changes to BitArray will enable these APIs to return a type of the
form BitArray<Lsb0, Self::BitStore, Self::NUM_BITS>.

We could add big-endian APIs later, but with the current API,
PrimeField::to_le_bits().into_repr().rev() will iterate over the bits in
big-endian order.

The MSRV is now 1.44.0, matching the bitvec crate.
This was an odd interface, that wrapped a little-endian byte encoding
and returned a big-endian bit stream. Its only use was for obtaining an
iterator over the bits of a PrimeField element, and users now have the
PrimeField::to_le_bits API (from which either endianness can be
obtained).
This was an awkward attempt to enable generic access to a specific
encoding endianness, in order to operate generically over the bits of a
field element. Now that we have PrimeField::to_le_bits, this associated
type (as well as the default dependency on the byteorder crate) is no
longer necessary.
@str4d str4d requested a review from ebfull September 2, 2020 13:35
This is necessary to use the output of PrimeField::to_le_bits across
threads, such as in a multiexp implementation.
src/lib.rs Outdated Show resolved Hide resolved
The field characteristic is not a valid field element, and we only ever
want to operate over its bits, which PrimeField::char_le_bits exposes.
@str4d str4d mentioned this pull request Sep 4, 2020
7 tasks
@ebfull ebfull merged commit 1bfb6c3 into master Sep 4, 2020
@str4d str4d deleted the bitvec branch September 4, 2020 13:47
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