mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
AK: Add an align_down_to power of two helper
Matching the similar align_up_to helper
This commit is contained in:
parent
5f012778b8
commit
33214c29d3
1 changed files with 5 additions and 0 deletions
|
@ -84,6 +84,11 @@ constexpr size_t align_up_to(const size_t value, const size_t alignment)
|
||||||
return (value + (alignment - 1)) & ~(alignment - 1);
|
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 {
|
enum class [[nodiscard]] TriState : u8 {
|
||||||
False,
|
False,
|
||||||
True,
|
True,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue