summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-07-12 01:28:18 +0200
committerGitHub <noreply@github.com>2020-07-12 01:28:18 +0200
commite5abf11186394989219ba672f7ccd652cd854237 (patch)
treef786a1f9e252b89d04664725c8b30d0c33aaa5e3
parentMerge pull request #4300 from FearlessTobi/port-5441 (diff)
parentRevert "Port citra-emu/citra#5441: "Common: remove a mod from AlignUp"" (diff)
downloadyuzu-e5abf11186394989219ba672f7ccd652cd854237.tar
yuzu-e5abf11186394989219ba672f7ccd652cd854237.tar.gz
yuzu-e5abf11186394989219ba672f7ccd652cd854237.tar.bz2
yuzu-e5abf11186394989219ba672f7ccd652cd854237.tar.lz
yuzu-e5abf11186394989219ba672f7ccd652cd854237.tar.xz
yuzu-e5abf11186394989219ba672f7ccd652cd854237.tar.zst
yuzu-e5abf11186394989219ba672f7ccd652cd854237.zip
-rw-r--r--src/common/alignment.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 516bb26c1..f8c49e079 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -11,9 +11,7 @@ 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.");
- auto mod{value % size};
- value -= mod;
- return static_cast<T>(mod == T{0} ? value : value + size);
+ return static_cast<T>(value + (size - value % size) % size);
}
template <typename T>