* Aligns given value down by specified alignment. Alignment must be power of 2. * * @param value Value to align. * @param alignment Alignment to use. * * @return Value aligned down. If alignment is not power of 2, * return value is undefined. */
| 40 | * return value is undefined. |
| 41 | */ |
| 42 | std::uint64_t alignDown(std::uint64_t value, std::uint64_t alignment) |
| 43 | { |
| 44 | return value & ~(alignment - 1); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Aligns given value up by specified alignment. Alignment must be power of 2. |