summaryrefslogtreecommitdiffstats
path: root/src/common/alignment.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/alignment.h')
-rw-r--r--src/common/alignment.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index d94a2291f..3379a6967 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -20,6 +20,11 @@ constexpr T AlignDown(T value, std::size_t size) {
}
template <typename T>
+constexpr T AlignBits(T value, T align) {
+ return (value + ((1 << align) - 1)) >> align << align;
+}
+
+template <typename T>
constexpr bool Is4KBAligned(T value) {
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
return (value & 0xFFF) == 0;