use crate::{small_float, Allocator};
pub fn min_allocator_size(needed_object_size: u32) -> u32 {
small_float::float_to_uint(small_float::uint_to_float_round_up(needed_object_size))
}
impl Allocator {
pub fn is_empty(&self) -> bool {
self.free_storage == self.size
}
}
#[cfg(test)]
mod tests {
use crate::*;
#[test]
fn ext_is_empty() {
let mut allocator: Allocator<u32> = Allocator::new(1024);
assert!(allocator.is_empty());
let allocation = allocator.allocate(1).unwrap();
assert!(!allocator.is_empty());
allocator.free(allocation);
assert!(allocator.is_empty());
}
}