openvm/utils.rs
1#[cfg(not(target_os = "zkvm"))]
2use num_bigint::BigUint;
3
4#[inline]
5#[cfg(not(target_os = "zkvm"))]
6#[allow(dead_code)]
7/// Convert a `BigUint` to a `[u8; NUM_LIMBS]` in little-endian format.
8pub fn biguint_to_limbs<const NUM_LIMBS: usize>(x: &BigUint) -> [u8; NUM_LIMBS] {
9 let mut sm = x.to_bytes_le();
10 sm.resize(NUM_LIMBS, 0);
11 sm.try_into().unwrap()
12}