libeditwl
Lightweight C++ library for Nintendo DS(i) formats
Loading...
Searching...
No Matches
util_Align.hpp
1
2#pragma once
3#include <twl/twl_Include.hpp>
4
5namespace twl::util {
6
7 template<typename T>
8 inline constexpr T AlignUp(const T value, const u64 align) {
9 const auto inv_mask = align - 1;
10 return static_cast<T>((value + inv_mask) & ~inv_mask);
11 }
12
13 template<typename T>
14 inline constexpr bool IsAlignedTo(const T value, const u64 align) {
15 return (value % align) == 0;
16 }
17
18}