From de982deb25f685dd8fa67680fb8dd6c627f70859 Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Mon, 24 Jun 2019 01:47:09 -0300
Subject: [PATCH] common/alignment: Address feedback

---
 src/common/alignment.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/common/alignment.h b/src/common/alignment.h
index 3379a69675..617b14d9b7 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>
-- 
GitLab