Module utils

Module utils 

Source
Expand description

Utility helpers for alignment, page size, and safe range calculations.

Functionsยง

align_up
Align a value up to the nearest multiple of alignment.
ensure_in_bounds
Ensure the requested [offset, offset+len) range is within [0, total). Returns Ok(()) if valid; otherwise an OutOfBounds error.
page_size
Get the system page size in bytes.
slice_range
Compute a safe byte slice range for a given total length, returning start..end as usize tuple.