libnedit
Lightweight C++ library for Nintendo DS(i) formats
Loading...
Searching...
No Matches
libnedit
include
ntr
util
util_Memory.hpp
1
2
#pragma once
3
#include <ntr/ntr_Include.hpp>
4
5
namespace
ntr::util {
6
7
template
<
typename
T>
8
inline
T *NewArray(
const
size_t
count) {
9
return
new
(std::nothrow) T[count]();
10
}
11
12
template
<
typename
T>
13
inline
constexpr
T AlignUp(
const
T value,
const
u64 align) {
14
const
auto
inv_mask = align - 1;
15
return
static_cast<
T
>
((value + inv_mask) & ~inv_mask);
16
}
17
18
template
<
typename
T>
19
inline
constexpr
bool
IsAlignedTo(
const
T value,
const
u64 align) {
20
return
(value % align) == 0;
21
}
22
23
}
Generated by
1.10.0