AK: Add an align_down_to power of two helper

Matching the similar align_up_to helper
This commit is contained in:
Idan Horowitz 2022-07-05 01:16:42 +03:00 committed by Andreas Kling
parent 5f012778b8
commit 33214c29d3
Notes: sideshowbarker 2024-07-17 22:09:47 +09:00

View file

@ -84,6 +84,11 @@ constexpr size_t align_up_to(const size_t value, const size_t alignment)
return (value + (alignment - 1)) & ~(alignment - 1);
}
constexpr size_t align_down_to(const size_t value, const size_t alignment)
{
return value & ~(alignment - 1);
}
enum class [[nodiscard]] TriState : u8 {
False,
True,