bitcoin-bigint 0.1.19

Provides an efficient macro-based approach to define and manipulate arbitrary-precision unsigned integers, crucial for cryptographic operations on Bitcoin.
1
2
3
4
5
6
7
8
9
10
11
12
// ---------------- [ File: bitcoin-bigint/src/limb_count.rs ]
crate::ix!();

#[inline]
pub const fn base_uint_limb_count(bits: usize) -> usize {
    // If you only ever do 160 or 256, match them:
    match bits {
        160 => 5,
        256 => 8,
        _ => panic!("Unsupported bits: must be 160 or 256"),
    }
}