Skip to main content

mynd_math/
lib.rs

1#![no_std]
2#![forbid(unsafe_code)]
3#![deny(missing_docs)]
4
5//! Checked integer arithmetic for Mynd's untrusted image-data boundaries.
6//!
7//! The crate provides constant-work, allocation-free primitives for integer
8//! conversion, addition, multiplication, alignment, and bounded ranges. Every
9//! failure is explicit; no operation wraps, saturates, truncates, or panics.
10
11mod convert;
12mod error;
13mod ops;
14mod range;
15
16#[cfg(kani)]
17mod proofs;
18
19pub use convert::{
20    checked_i64_to_u64, checked_i64_to_usize, checked_u64_to_i64, checked_u64_to_u32,
21    checked_u64_to_usize, checked_usize_to_u64,
22};
23pub use error::{ArithmeticOperation, MathError, MathResult};
24pub use ops::{
25    checked_add_u64, checked_add_usize, checked_align_up_u64, checked_align_up_usize,
26    checked_mul_u64, checked_mul_usize,
27};
28pub use range::{checked_range_u64, checked_range_usize};