summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-03-31 20:15:43 +0200
committerbunnei <bunneidev@gmail.com>2020-04-17 06:59:28 +0200
commitb838e58d63c817aef365e023d2865033bcad0ac4 (patch)
tree00b1e3feaaedfdfbebffaa71f429166d1b96dbd6
parentcore: kernel: Add svc_types header to include SVC-specific types. (diff)
downloadyuzu-b838e58d63c817aef365e023d2865033bcad0ac4.tar
yuzu-b838e58d63c817aef365e023d2865033bcad0ac4.tar.gz
yuzu-b838e58d63c817aef365e023d2865033bcad0ac4.tar.bz2
yuzu-b838e58d63c817aef365e023d2865033bcad0ac4.tar.lz
yuzu-b838e58d63c817aef365e023d2865033bcad0ac4.tar.xz
yuzu-b838e58d63c817aef365e023d2865033bcad0ac4.tar.zst
yuzu-b838e58d63c817aef365e023d2865033bcad0ac4.zip
-rw-r--r--src/common/alignment.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index cdd4833f8..f8c49e079 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -38,6 +38,13 @@ constexpr bool IsWordAligned(T value) {
return (value & 0b11) == 0;
}
+template <typename T>
+constexpr bool IsAligned(T value, std::size_t alignment) {
+ using U = typename std::make_unsigned<T>::type;
+ const U mask = static_cast<U>(alignment - 1);
+ return (value & mask) == 0;
+}
+
template <typename T, std::size_t Align = 16>
class AlignmentAllocator {
public: