OpenBarnyard
Loading...
Searching...
No Matches
TBitArray.h
Go to the documentation of this file.
1
#pragma once
2
3
TOSHI_NAMESPACE_START
4
5
class
TOSHI_API
TBitArray
6
{
7
public
:
8
// Constructors/destructor
9
constexpr
TBitArray
()
10
: m_pBuffer(
TNULL
), m_uiInitialisedWith( 0 ), m_iSize( 0 )
11
{}
12
13
TBitArray
(
TINT
a_iNumBits,
TINT
a_iInitialiseWith );
14
15
~TBitArray
();
16
17
// Allocates memory for the specified number of bits
18
void
Create(
TINT
a_iNumBits,
TINT
a_iInitialiseWith );
19
20
// Frees the buffer
21
void
Destroy();
22
23
// Resets all the bits to their initial state
24
void
Reset();
25
26
// Sets a bit at a_iIndex to a_iValue
27
void
SetBit(
TINT
a_iIndex,
TINT
a_iValue );
28
29
// Sets a bit at a_iIndex to 1
30
void
SetBit(
TINT
a_iIndex );
31
32
// Toggles a bit at a_iIndex
33
void
ToggleBit(
TINT
a_iIndex );
34
35
// Sets a bit at a_iIndex to 0
36
void
ClearBit(
TINT
a_iIndex );
37
38
// Returns 1 if a bit at a_iIndex is set or zero if it's not set
39
TINT
GetBit(
TINT
a_iIndex )
const
;
40
41
// Returns index of the first set (1) bit
42
TINT
FindFirstSetBit();
43
44
// Returns index of the first clear (0) bit
45
TINT
FindFirstClearBit();
46
47
// Returns number of bytes allocated for the buffer
48
TINT
GetNumAllocatedBytes()
const
;
49
50
private
:
51
TUINT32
* m_pBuffer;
52
TINT
m_iSize;
53
TUINT
m_uiInitialisedWith;
54
};
55
56
TOSHI_NAMESPACE_END
TOSHI_API
#define TOSHI_API
Definition
Defines.h:41
TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_START
Definition
Defines.h:47
TOSHI_NAMESPACE_END
#define TOSHI_NAMESPACE_END
Definition
Defines.h:50
TUINT
unsigned int TUINT
Definition
Typedefs.h:8
TNULL
#define TNULL
Definition
Typedefs.h:23
TUINT32
uint32_t TUINT32
Definition
Typedefs.h:13
TINT
int TINT
Definition
Typedefs.h:7
TBitArray
Definition
TBitArray.h:6
TBitArray::TBitArray
constexpr TBitArray()
Definition
TBitArray.h:9
D:
_dev
OpenBarnyard
Source
Toshi
Source
Toshi
TBitArray.h
Generated by
1.13.2