1
2
3
4
5
6
7
8
9
#![deny(clippy::arithmetic_side_effects)]
pub mod aligned_memory;

/// Returns true if `ptr` is aligned to `align`.
pub fn is_memory_aligned(ptr: usize, align: usize) -> bool {
    ptr.checked_rem(align)
        .map(|remainder| remainder == 0)
        .unwrap_or(false)
}