diff options
author | Ameer <aj662@drexel.edu> | 2020-07-14 19:04:02 +0200 |
---|---|---|
committer | Ameer <aj662@drexel.edu> | 2020-07-14 19:04:02 +0200 |
commit | 93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3 (patch) | |
tree | c4ab9e3acff296733b00effd85371bf04db6491f /src/common/alignment.h | |
parent | Break out of scan loop if can't find adapter on first run (diff) | |
parent | Merge pull request #4294 from MerryMage/cpu-opt-settings (diff) | |
download | yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.gz yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.bz2 yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.lz yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.xz yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.zst yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.zip |
Diffstat (limited to '')
-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 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> |