diff options
author | Zach Hilman <DarkLordZach@users.noreply.github.com> | 2019-07-05 19:39:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-05 19:39:13 +0200 |
commit | 772c86a260eb446b0fe4232b0a50666511bef25c (patch) | |
tree | 013d92268c06454c93565c83eff2b79b56a00839 /src/common/alignment.h | |
parent | Merge pull request #2669 from FearlessTobi/move-cpujit-setting (diff) | |
parent | texture_cache: Address Feedback (diff) | |
download | yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar.gz yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar.bz2 yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar.lz yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar.xz yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.tar.zst yuzu-772c86a260eb446b0fe4232b0a50666511bef25c.zip |
Diffstat (limited to 'src/common/alignment.h')
-rw-r--r-- | src/common/alignment.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index d94a2291f..617b14d9b 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -20,6 +20,12 @@ constexpr T AlignDown(T value, std::size_t size) { } template <typename T> +constexpr T AlignBits(T value, std::size_t align) { + static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); + return static_cast<T>((value + ((1ULL << align) - 1)) >> align << align); +} + +template <typename T> constexpr bool Is4KBAligned(T value) { static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); return (value & 0xFFF) == 0; |