PixelBullet
0.0.1
A C++ game engine
Loading...
Searching...
No Matches
engine
include
pixelbullet
core
bits.h
1
#pragma once
2
3
#include "
pixelbullet/core/assert.h
"
4
5
#include <concepts>
6
#include <cstdint>
7
#include <limits>
8
9
namespace
pixelbullet
10
{
11
template
<std::
unsigned
_
int
egral T = std::u
int
32_t>
12
constexpr
T bit(
unsigned
int
index)
13
{
14
ASSERT
(index < std::numeric_limits<T>::digits,
"Bit index {} is out of range for {} bits"
, index, std::numeric_limits<T>::digits);
15
return
static_cast<
T
>
(T{ 1 } << index);
16
}
17
}
// namespace pixelbullet
assert.h
Provides assertion and panic mechanisms with optional custom formatting.
ASSERT
#define ASSERT(condition,...)
Asserts that a condition is true.
Definition
assert.h:142
Generated by
1.16.1