diff --git a/externals/oaknut/include/oaknut/oaknut.hpp b/externals/oaknut/include/oaknut/oaknut.hpp index 7e80992d..4aea7a53 100644 --- a/externals/oaknut/include/oaknut/oaknut.hpp +++ b/externals/oaknut/include/oaknut/oaknut.hpp @@ -159,6 +159,16 @@ public: } } + void align(std::size_t alignment) + { + if (alignment < 4 || (alignment & (alignment - 1)) != 0) + throw "invalid alignment"; + + while (Policy::template ptr() & (alignment - 1)) { + NOP(); + } + } + void dw(std::uint32_t value) { Policy::append(value); @@ -235,7 +245,7 @@ public: template T ptr() { - static_assert(std::is_pointer_v); + static_assert(std::is_pointer_v || std::is_same_v || std::is_same_v); return reinterpret_cast(m_ptr); }