Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

Revert "Port citra-emu/citra#5441: "Common: remove a mod from AlignUp""

bunnei1b617c2e3525
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 516bb26c13..f8c49e0797 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>