Expand description
Checked integer arithmetic for Mynd’s untrusted image-data boundaries.
The crate provides constant-work, allocation-free primitives for integer conversion, addition, multiplication, alignment, and bounded ranges. Every failure is explicit; no operation wraps, saturates, truncates, or panics.
Enums§
- Arithmetic
Operation - The checked operation that could not be represented by its output type.
- Math
Error - A failure from a checked Mynd arithmetic primitive.
Functions§
- checked_
add_ u64 - Adds two
u64values without wrapping or saturating. - checked_
add_ usize - Adds two
usizevalues without wrapping or saturating. - checked_
align_ up_ u64 - Rounds
valueupward to a multiple ofalignmentinu64arithmetic. - checked_
align_ up_ usize - Rounds
valueupward to a multiple ofalignmentinusizearithmetic. - checked_
i64_ to_ u64 - Converts a nonnegative
i64value tou64. - checked_
i64_ to_ usize - Converts a nonnegative
i64value tousizewithout truncation. - checked_
mul_ u64 - Multiplies two
u64values without wrapping or saturating. - checked_
mul_ usize - Multiplies two
usizevalues without wrapping or saturating. - checked_
range_ u64 - Constructs a half-open
u64range contained by an exclusive upper bound. - checked_
range_ usize - Constructs a half-open
usizerange contained by an exclusive upper bound. - checked_
u64_ to_ i64 - Converts
u64toi64without truncation or sign change. - checked_
u64_ to_ u32 - Converts
u64tou32without truncation. - checked_
u64_ to_ usize - Converts
u64tousizewithout truncation. - checked_
usize_ to_ u64 - Converts
usizetou64without truncation.
Type Aliases§
- Math
Result - The result type returned by checked Mynd arithmetic primitives.