PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
bits.h
1#pragma once
2
4
5#include <concepts>
6#include <cstdint>
7#include <limits>
8
9namespace pixelbullet
10{
11template <std::unsigned_integral T = std::uint32_t>
12constexpr 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
Provides assertion and panic mechanisms with optional custom formatting.
#define ASSERT(condition,...)
Asserts that a condition is true.
Definition assert.h:142