From d340ff8cfaacf87787ab206892eae5534cb0d446 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Mon, 20 Mar 2023 15:04:43 -0700 Subject: [PATCH] addressed comments --- evm/src/util.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/evm/src/util.rs b/evm/src/util.rs index fb0700c3..a44b4b60 100644 --- a/evm/src/util.rs +++ b/evm/src/util.rs @@ -145,10 +145,11 @@ pub(crate) fn biguint_to_u256(x: BigUint) -> U256 { U256::from_little_endian(&bytes) } -pub(crate) fn le_limbs_to_biguint(x: &[u128]) -> BigUint { +pub(crate) fn mem_vec_to_biguint(x: &[U256]) -> BigUint { BigUint::from_slice( &x.iter() - .flat_map(|&a| { + .map(|&n| n.try_into().unwrap()) + .flat_map(|a: u128| { [ (a % (1 << 32)) as u32, ((a >> 32) % (1 << 32)) as u32, @@ -160,10 +161,6 @@ pub(crate) fn le_limbs_to_biguint(x: &[u128]) -> BigUint { ) } -pub(crate) fn mem_vec_to_biguint(x: &[U256]) -> BigUint { - le_limbs_to_biguint(&x.iter().map(|&n| n.try_into().unwrap()).collect_vec()) -} - pub(crate) fn biguint_to_mem_vec(x: BigUint) -> Vec { let mut digits = x.to_u32_digits();