af_utilities/types/onchain.rs
1//! Helpers related to the onchain storage representation of this crate's numerical types.
2use af_sui_types::u256::U256;
3
4pub fn greatest_bit() -> U256 {
5 U256::one() << 255_u8
6}
7
8pub fn not_greatest_bit() -> U256 {
9 greatest_bit() - U256::one()
10}
11
12/// Maximal possible (positive) value of i256 that equals 2^255 - 1.
13pub fn max_i256() -> U256 {
14 not_greatest_bit()
15}