Skip to content
Snippets Groups Projects
Commit de982deb authored by ReinUsesLisp's avatar ReinUsesLisp
Browse files

common/alignment: Address feedback

parent d1812316
No related branches found
No related tags found
No related merge requests found
...@@ -20,8 +20,9 @@ constexpr T AlignDown(T value, std::size_t size) { ...@@ -20,8 +20,9 @@ constexpr T AlignDown(T value, std::size_t size) {
} }
template <typename T> template <typename T>
constexpr T AlignBits(T value, T align) { constexpr T AlignBits(T value, std::size_t align) {
return (value + ((1 << align) - 1)) >> align << 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> template <typename T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment