#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
mod allocator;
mod block;
mod buddy;
mod config;
mod error;
mod heap;
mod linear;
mod slab;
mod usage;
mod util;
#[cfg(feature = "freelist")]
mod freelist;
pub use {
self::{allocator::*, block::MemoryBlock, config::*, error::*, usage::*},
gpu_alloc_types::*,
};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct Request {
pub size: u64,
pub align_mask: u64,
pub usage: UsageFlags,
pub memory_types: u32,
}
pub(crate) fn align_up(value: u64, align_mask: u64) -> Option<u64> {
Some(value.checked_add(align_mask)? & !align_mask)
}
pub(crate) fn align_down(value: u64, align_mask: u64) -> u64 {
value & !align_mask
}
#[cfg(debug_assertions)]
#[allow(unused_unsafe)]
unsafe fn unreachable_unchecked() -> ! {
unreachable!()
}
#[cfg(not(debug_assertions))]
unsafe fn unreachable_unchecked() -> ! {
core::hint::unreachable_unchecked()
}
use core::fmt::Debug as MemoryBounds;