diff --git a/packages/bytes/src/utils.cairo b/packages/bytes/src/utils.cairo index 72dd13f4..b4ad35d0 100644 --- a/packages/bytes/src/utils.cairo +++ b/packages/bytes/src/utils.cairo @@ -58,7 +58,7 @@ pub fn keccak_u128s_be(input: Span, n_bytes: usize) -> u256 { let mut keccak_input = array![]; let mut size = n_bytes; for v in input { - let value_size = uint_min(size, 16); + let value_size = core::cmp::min(size, 16); keccak_add_uint128_be(ref keccak_input, *v, value_size); size -= value_size; }; @@ -74,16 +74,6 @@ pub fn keccak_u128s_be(input: Span, n_bytes: usize) -> u256 { } } -/// return the minimal value -/// support u8, u16, u32, u64, u128, u256 -fn uint_min, +PartialOrd, +Copy>(l: T, r: T) -> T { - if l <= r { - l - } else { - r - } -} - fn u256_reverse_endian(input: u256) -> u256 { let low = u128_byte_reverse(input.high); let high = u128_byte_reverse(input.low);