Macro ethnum::int

source ·
macro_rules! int {
    ($integer:literal) => { ... };
}
Expand description

Macro for 256-bit signed integer literal.

Examples

Basic usage:

assert_eq!(
    int!(
        "-57896044618658097711785492504343953926634992332820282019728792003956564819968"
    ),
    I256::MIN,
);

Additionally, this macro accepts 0b for binary, 0o for octal, and 0x for hexadecimal literals. Using _ for spacing is also permitted.

assert_eq!(
    int!(
        "0x7fff_ffff_ffff_ffff_ffff_ffff_ffff_ffff
           ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff"
    ),
    I256::MAX,
);
assert_eq!(int!("0b101010"), 42);
assert_eq!(int!("-0o52"), -42);