diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/alignment.h | 5 |
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> |