num_bits

Function num_bits 

Source
pub fn num_bits<F: Field>(n: F) -> usize
Expand description

Returns the minimum numbers of bits required to represent prime field elements in the range [0, n]. This is equivalent to computing ceil(log_2(n+1)).

§Complexity

Constant in the size of the representation of n.

§Example

    use shared_types::Fr;
    use remainder::mle::evals::bit_packed_vector::num_bits;

    assert_eq!(num_bits(Fr::from(0)), 0);
    assert_eq!(num_bits(Fr::from(31)), 5);
    assert_eq!(num_bits(Fr::from(32)), 6);