/// Calculate how many base and large pages we need to fit a given size.
///
/// # Returns
/// A tuple containing (base-pages, large-pages).
/// base-pages will never exceed LARGE_PAGE_SIZE / BASE_PAGE_SIZE.
Calculate how many base and large pages we need to fit a given size.
Calculate how many base and large pages we need to fit a given size .
pub fn size_to_pages(size: usize) -> (usize, usize) {
    let bytes_not_in_large = size % LARGE_PAGE_SIZE;
    let div = bytes_not_in_large / BASE_PAGE_SIZE;
    let rem = bytes_not_in_large % BASE_PAGE_SIZE;
    let base_pages = if rem > 0 { div + 1 } else { div };
    let remaining_size = size - bytes_not_in_large;
    let div = remaining_size / LARGE_PAGE_SIZE;
    let rem = remaining_size % LARGE_PAGE_SIZE;
    let large_pages = if rem > 0 { div + 1 } else { div };
    (base_pages, large_pages)
}
pub fn size_to_pages ( size : usize ) -> ( usize , usize ) { let bytes_not_in_large = size % LARGE_PAGE_SIZE ; let div = bytes_not_in_large / BASE_PAGE_SIZE ; let rem = bytes_not_in_large % BASE_PAGE_SIZE ; let base_pages = if rem > 0 { div + 1 } else { div } ; let remaining_size = size - bytes_not_in_large ; let div = remaining_size / LARGE_PAGE_SIZE ; let rem = remaining_size % LARGE_PAGE_SIZE ; let large_pages = if rem > 0 { div + 1 } else { div } ; ( base_pages , large_pages ) }
Calculate how many base and large pages we need to fit a given size.
Calculate how many base and large pages we need to fit a given size .
A tuple containing (base-pages, large-pages).
base-pages will never exceed LARGE_PAGE_SIZE / BASE_PAGE_SIZE.
A tuple containing ( base - pages large - pages ) . base - pages will never exceed LARGE_PAGE_SIZE / BASE_PAGE_SIZE .
size
usize