summaryrefslogtreecommitdiffstats
path: root/src/common/alignment.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-06-24 06:47:09 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-06-24 06:47:09 +0200
commitde982deb25f685dd8fa67680fb8dd6c627f70859 (patch)
treebf487a9cbcd5952aa2dc28f5046881c7dec278a5 /src/common/alignment.h
parenttexture_cache: Style and Corrections (diff)
downloadyuzu-de982deb25f685dd8fa67680fb8dd6c627f70859.tar
yuzu-de982deb25f685dd8fa67680fb8dd6c627f70859.tar.gz
yuzu-de982deb25f685dd8fa67680fb8dd6c627f70859.tar.bz2
yuzu-de982deb25f685dd8fa67680fb8dd6c627f70859.tar.lz
yuzu-de982deb25f685dd8fa67680fb8dd6c627f70859.tar.xz
yuzu-de982deb25f685dd8fa67680fb8dd6c627f70859.tar.zst
yuzu-de982deb25f685dd8fa67680fb8dd6c627f70859.zip
Diffstat (limited to 'src/common/alignment.h')
-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>