summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias <thm.frey@gmail.com>2020-07-12 16:45:49 +0200
committerGitHub <noreply@github.com>2020-07-12 16:45:49 +0200
commit80a0f2a118b858b3ceb4ae0ae09d72353d58c928 (patch)
treed41257ef294df43612dcec9de2b05f1a2987d689
parentMerge pull request #4312 from Morph1984/fix-discord-invite (diff)
downloadyuzu-80a0f2a118b858b3ceb4ae0ae09d72353d58c928.tar
yuzu-80a0f2a118b858b3ceb4ae0ae09d72353d58c928.tar.gz
yuzu-80a0f2a118b858b3ceb4ae0ae09d72353d58c928.tar.bz2
yuzu-80a0f2a118b858b3ceb4ae0ae09d72353d58c928.tar.lz
yuzu-80a0f2a118b858b3ceb4ae0ae09d72353d58c928.tar.xz
yuzu-80a0f2a118b858b3ceb4ae0ae09d72353d58c928.tar.zst
yuzu-80a0f2a118b858b3ceb4ae0ae09d72353d58c928.zip
-rw-r--r--src/common/alignment.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index f8c49e079..b37044bb6 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -11,7 +11,9 @@ namespace Common {
template <typename T>
constexpr T AlignUp(T value, std::size_t size) {
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
- return static_cast<T>(value + (size - value % size) % size);
+ auto mod{static_cast<T>(value % size)};
+ value -= mod;
+ return static_cast<T>(mod == T{0} ? value : value + size);
}
template <typename T>