af_utilities/types/
onchain.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Helpers related to the onchain storage representation of this crate's numerical types.
use af_sui_types::u256::U256;

pub fn greatest_bit() -> U256 {
    U256::one() << 255_u8
}

pub fn not_greatest_bit() -> U256 {
    greatest_bit() - U256::one()
}

/// Maximal possible (positive) value of i256 that equals 2^255 - 1.
pub fn max_i256() -> U256 {
    not_greatest_bit()
}