VERY experimental Nintendo Switch 2 emulator
C++
common: alignment: Add a helper function for generic alignment checking.
bunnei94e00fbb3fc6
diff --git a/src/common/alignment.h b/src/common/alignment.hindex cdd4833f81..f8c49e0797 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: