Expand description
Calculation, conversion and rounding for memory related numbers.
Functionsยง
- Convert an address to the chunk index (aligned down).
- Convert size in bytes to the number of chunks (aligned up).
- Convert size in bytes to a readable short string, such as 1GB, 2TB, etc. It only keeps the major unit and keeps no fraction.
- Convert size in bytes to the number of pages (aligned up)
- Align down an address to the nearest chunk.
- Align up an address to the nearest chunk.
- Convert a chunk index to the start address of the chunk.
- Is the address aligned to word boundary?
- Is the address aligned to page boundary?
- Align down an address to the nearest chunk at which granularity we mmap memory.
- Align up an address to the nearest chunk at which granularity we mmap memory.
- Align down an address to the nearest page.
- Convert the number of pages to bytes.
- Align down an integer to the given alignment.
align
must be a power of two. - Align up an integer to the given alignment.
align
must be a power of two. - Is the integer aligned to the given alignment?
align
must be a power of two.