mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +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
Notes:
sideshowbarker
2024-07-17 22:09:47 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/33214c29d3 Pull-request: https://github.com/SerenityOS/serenity/pull/14487
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);
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue