#![deny(clippy::integer_arithmetic)]
really helps thinking about corner cases... e.g. I turned your: https://github.com/enarx/enarx/blob/master/enarx-keep-sgx/src/layout.rs#L19-L24fn raise(value: usize, boundary: usize) -> Option<usize> {
value
.checked_add(boundary)
.and_then(|v| v.checked_sub(1))
.map(|v| lower(v, boundary))
}
unsafe {}
#[inline(always)]
const fn lower(value: usize, boundary: usize) -> usize {
#![allow(clippy::integer_arithmetic)]
// integer_arithmetic checked
value / boundary * boundary
}
#[inline(always)]
fn raise(value: usize, boundary: usize) -> Option<usize> {
value
.checked_add(boundary)
.map(|v| v.wrapping_sub(1))
.map(|v| lower(v, boundary))
}
wrapping_*
#[cfg(not(feature = "unlikely_to_exist_feature"))