Skip to main content

Module checked

Module checked 

Source
Expand description

Checked arithmetic: None on overflow.

CT tier B (caller-leaky) for the branchless checked atoms (add/sub/mul/neg/shifts/abs): the Option return invites branching on secret-derived data at the call site. Masked counterparts live in ops::ct (cargo feature ct). CheckedDiv/CheckedRem are CT-hostile (data-dependent division) and CheckedPow is exponent-dependent — Tier C for secret inputs.

Traits§

CheckedAbs
Computes the absolute value, returning None if it can’t be represented.
CheckedAdd
Performs addition, returning None if overflow occurred.
CheckedDiv
Performs division, returning None on division by zero or if overflow occurred.
CheckedMul
Performs multiplication, returning None if overflow occurred.
CheckedNeg
Performs negation, returning None if the result can’t be represented.
CheckedPow
Performs exponentiation, returning None if overflow occurred.
CheckedRem
Performs integral remainder, returning None on division by zero or if overflow occurred.
CheckedShl
Performs shift left, returning None on shifts larger than or equal to the type width.
CheckedShr
Performs shift right, returning None on shifts larger than or equal to the type width.
CheckedSub
Performs subtraction, returning None if overflow occurred.