acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
bits.h
1
#pragma once
2
3
4
5
6
template
< prototype_natural NATURAL >
7
class
bits
8
{
9
public
:
10
11
12
NATURAL m_natural;
13
14
15
bits() { m_natural = 0; }
16
bits(
no_initialize_t
) {}
17
bits(NATURAL n) : m_natural(n) { }
18
bits(nullptr_t) { m_natural = 0; }
19
20
21
template
< prototype_
int
egral INTEGRAL >
22
inline
bool
is_set(INTEGRAL bit)
const
{
return
(m_natural >> (::u8) bit) & 1; }
23
template
< prototype_
int
egral INTEGRAL >
24
inline
void
set(INTEGRAL bit) { m_natural = m_natural | (NATURAL)(1ull << (::u8)bit); }
25
template
< prototype_
int
egral INTEGRAL >
26
inline
void
unset(INTEGRAL bit) { m_natural = m_natural & (NATURAL)(~(1ull << (::u8)bit)); }
27
template
< prototype_
int
egral INTEGRAL >
28
inline
void
set(INTEGRAL bit,
bool
bSet) {
if
(bSet) set(bit);
else
unset(bit); }
29
30
31
template
< prototype_
int
egral INTEGRAL >
32
bool
operator [] (INTEGRAL bit)
const
{
return
is_set(bit); }
33
34
35
};
36
37
no_initialize_t
Definition
_tags.h:5
prototype
prototype
bits.h
Generated by
1.17.0