]>
git.proxmox.com Git - rustc.git/blob - vendor/crypto-bigint/src/nlimbs.rs
1 /// Calculate the number of limbs required to represent the given number of bits.
2 // TODO(tarcieri): replace with `generic_const_exprs` (rust-lang/rust#76560) when stable
6 $bits
/ $
crate::Limb
::BITS
12 #[cfg(target_pointer_width = "32")]
14 fn nlimbs_for_bits_macro() {
15 assert_eq
!(nlimbs
!(64), 2);
16 assert_eq
!(nlimbs
!(128), 4);
17 assert_eq
!(nlimbs
!(192), 6);
18 assert_eq
!(nlimbs
!(256), 8);
21 #[cfg(target_pointer_width = "64")]
23 fn nlimbs_for_bits_macro() {
24 assert_eq
!(nlimbs
!(64), 1);
25 assert_eq
!(nlimbs
!(128), 2);
26 assert_eq
!(nlimbs
!(192), 3);
27 assert_eq
!(nlimbs
!(256), 4);