diff options
| author | bunnei <bunneidev@gmail.com> | 2020-07-11 14:54:34 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-11 14:54:34 -0400 |
| commit | f5c026dd2d77ec707150aeec0c55df744bae6f9b (patch) | |
| tree | cbd176cf7b3dd85cde0b8fb65f8df38727d1c9a5 /src/common | |
| parent | 12834a1c449bc027dd73f9d404602bb8a6ba37fa (diff) | |
| parent | ebab55ab8f0b5257fbd431fc9575f06e57247b68 (diff) | |
Merge pull request #4300 from FearlessTobi/port-5441
Port citra-emu/citra#5441: "Common: remove a mod from AlignUp"
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/alignment.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index f8c49e0797..516bb26c13 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{value % size}; + value -= mod; + return static_cast<T>(mod == T{0} ? value : value + size); } template <typename T> |
