polymorph-allocator 0.1.0-beta.1

A minimal memory manager for no_std
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
pub fn align_down(addr: usize, align: usize) -> usize {
    if align.is_power_of_two() {
        addr & !(align - 1)
    } else if align == 0 {
        addr
    } else {
        panic!("non power-of-two alignment");
    }
}

pub fn align_up(addr: usize, align: usize) -> usize {
    align_down(addr + align - 1, align)
}