dreamcast/align.hpp
Zack Buhman 9bd79c6664 maple: remove cruft from maple_wink
This also adds a new overload for align_32byte for integers.
2023-12-15 19:06:59 +08:00

15 lines
270 B
C++

#pragma once
#include <cstdint>
template <typename T>
constexpr inline T * align_32byte(T * mem)
{
return reinterpret_cast<T *>((((reinterpret_cast<uint32_t>(mem) + 31) & ~31)));
}
constexpr inline uint32_t align_32byte(uint32_t mem)
{
return (mem + 31) & ~31;
}