Skip to main content

checked_arith

Function checked_arith 

Source
fn checked_arith(
    checked: Option<U256>,
    wrapping: U256,
    width: Option<usize>,
) -> Option<U256>
Expand description

Resolves a default-checked unsigned arithmetic result.

For a width-carrying operand the result type is checked: it must neither overflow 256 bits (checked is None) nor exceed its uintN width, otherwise the expression reverts at runtime and we return None instead of seeding an unreachable value. Untyped literal operands keep the 256-bit wrapping value.