memory_addr

Crates.io

Wrappers and helper functions for physical and virtual memory addresses.

Examples

```rust use memory_addr::{PhysAddr, VirtAddr};

let physaddr = PhysAddr::from(0x12345678); let virtaddr = VirtAddr::from(0x87654321);

asserteq!(physaddr.aligndown(0x1000usize), PhysAddr::from(0x12345000)); asserteq!(physaddr.alignoffset4k(), 0x678); asserteq!(virtaddr.alignup4k(), VirtAddr::from(0x87655000)); assert!(!virtaddr.isaligned4k()); assert!(VirtAddr::from(0xabcedf0).is_aligned(16usize)); ```