EnTT
4.0.0
Loading...
Searching...
No Matches
src
entt
core
bit.hpp
1
#ifndef ENTT_CORE_BIT_HPP
2
#define ENTT_CORE_BIT_HPP
3
4
#include "../config/config.h"
5
#include "../stl/bit.hpp"
6
#include "../stl/concepts.hpp"
7
#include "../stl/cstddef.hpp"
8
9
namespace
entt
{
10
18
template
<stl::
unsigned
_
int
egral Type>
19
[[nodiscard]]
constexpr
Type
fast_mod
(
const
Type value,
const
stl::size_t mod)
noexcept
{
20
ENTT_ASSERT_CONSTEXPR(stl::has_single_bit(mod),
"Value must be a power of two"
);
21
return
static_cast<
Type
>
(value & (mod - 1u));
22
}
23
24
}
// namespace entt
25
26
#endif
entt
EnTT default namespace.
Definition
dense_map.hpp:25
entt::fast_mod
constexpr Type fast_mod(const Type value, const stl::size_t mod) noexcept
Fast module utility function (powers of two only).
Definition
bit.hpp:19
Generated by
1.14.0