SDEngine
Game Engine
Loading...
Searching...
No Matches
math_utils.hpp
Go to the documentation of this file.
1
#pragma once
2
namespace
sd
{
3
8
namespace
math
{
9
// TODO(docs): Document log2_int - explain use case, constraints (what happens with 0)
10
consteval
usize
log2_int
(std::unsigned_integral
auto
n
) {
11
// log2(n) = bit_width(n) - 1
12
return
n
== 0 ? 0 : std::bit_width(
n
) - 1;
13
}
14
}
// namespace math
15
16
17
}
// namespace sd
math
Math utilities.
sd::math::log2_int
consteval usize log2_int(std::unsigned_integral auto n)
Definition
math_utils.hpp:10
sd
Definition
Application.hpp:28
g_type_max
constexpr T g_type_max
Definition
types.hpp:21
usize
std::size_t usize
Definition
types.hpp:18
SD
include
SD
core
math_utils.hpp
Generated by
1.9.8