summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/alignment.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 3379a6967..617b14d9b 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -20,8 +20,9 @@ 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;
+constexpr T AlignBits(T value, std::size_t align) {
+ static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
+ return static_cast<T>((value + ((1ULL << align) - 1)) >> align << align);
}
template <typename T>