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

Rename BIT_SIZE -> BITS, BYTE_SIZE -> BYTES #157

Merged
merged 2 commits into from
Dec 24, 2022

Conversation

fjarri
Copy link
Contributor

@fjarri fjarri commented Dec 23, 2022

Fixes #154

  • rename BIT_SIZE to BITS and BYTE_SIZE to BYTES to match the constants in the primitive types
  • add BITS and BYTES to Uint (instead of only having them in Encoding), similarly to how it's done for Limb

Now about the usize -> u32, I've tried to implement that, and I am reconsidering it. It really feels more natural in many places to have those constants be usize, otherwise there's a lot of as casts necessary (unless we also have const LIMBS: u32). leading_zeros() etc can be made to return u32 more easily, but that would introduce an inconsistency with BITS. Perhaps we can leave the types as is after all.

@tarcieri tarcieri changed the title Bit counting api Rename BIT_SIZE -> BITS, BYTE_SIZE -> BYTES Dec 24, 2022
@tarcieri tarcieri merged commit 6cb2ac9 into RustCrypto:master Dec 24, 2022
@fjarri fjarri deleted the bit-counting-api branch December 24, 2022 17:22
@tarcieri tarcieri mentioned this pull request Feb 27, 2023
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.

Bit-counting API is inconsistent with that of primitive types
2 participants