Open feltroidprime opened 1 year ago
we should add these for additional types - but currently you can rather efficiently implement by:
fn u64_byte_reverse(word: u64) -> u64 {
(u128_byte_reverse(word.into()) / 0x10000000000000000).try_into().unwrap()
}
Hello!
reverse endianness of u64 is useful in many cases when dealing with keccak
I wanted to implement it based off this https://github.com/starkware-libs/cairo-lang/blob/3a32740d0a743af6f4bfe227d1b5ecab0fc2884b/src/starkware/cairo/common/uint256.cairo#L464-L510
with 3 steps instead of 4
the problem is that
&
is not implemented on felt252 and u128 isn't large enough and gives mul overflowis it possible to add a u64_byte_reverse in the integer core lib ?
thanks!!