summaryrefslogtreecommitdiff
path: root/src/common/alignment.h
diff options
context:
space:
mode:
authorGravatar Lioncash2018-10-18 12:55:27 -0400
committerGravatar Lioncash2018-10-18 12:57:02 -0400
commitd27f4a4928f493f9e7a2987ad93e6be918b70f6c (patch)
tree9b5c2faf236744707520c788dc4cdfde68c7e045 /src/common/alignment.h
parentMerge pull request #1510 from lioncash/xci (diff)
downloadyuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar.gz
yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.tar.xz
yuzu-d27f4a4928f493f9e7a2987ad93e6be918b70f6c.zip
common: Move Is4KBAligned() to alignment.h
Aligning on 4KB pages isn't a Switch-specific thing, so this can be moved to common so it can be used with other things as well.
Diffstat (limited to 'src/common/alignment.h')
-rw-r--r--src/common/alignment.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 225770fab..b3f103c07 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -19,4 +19,10 @@ constexpr T AlignDown(T value, std::size_t size) {
19 return static_cast<T>(value - value % size); 19 return static_cast<T>(value - value % size);
20} 20}
21 21
22template <typename T>
23constexpr bool Is4KBAligned(T value) {
24 static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
25 return (value & 0xFFF) == 0;
26}
27
22} // namespace Common 28} // namespace Common