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.
This commit is contained in:
parent
d4ff4152ad
commit
d27f4a4928
2 changed files with 13 additions and 9 deletions
|
@ -19,4 +19,10 @@ constexpr T AlignDown(T value, std::size_t size) {
|
|||
return static_cast<T>(value - value % size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr bool Is4KBAligned(T value) {
|
||||
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
|
||||
return (value & 0xFFF) == 0;
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue