macro_rules! uint { ($integer:literal) => { ... }; }
Expand description
Macro for 256-bit unsigned integer literal.
§Examples
Basic usage:
assert_eq!(
uint!(
"115792089237316195423570985008687907852837564279074904382605163141518161494337"
),
U256::from_words(
0xfffffffffffffffffffffffffffffffe,
0xbaaedce6af48a03bbfd25e8cd0364141,
),
);
Additionally, this macro accepts 0b
for binary, 0o
for octal, and 0x
for hexadecimal literals. Using _
for spacing is also permitted.
assert_eq!(
uint!(
"0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff
ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff"
),
U256::MAX,
);
assert_eq!(uint!("0b101010"), 42);
assert_eq!(uint!("0o52"), 42);