-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitPool.h
More file actions
33 lines (26 loc) · 756 Bytes
/
BitPool.h
File metadata and controls
33 lines (26 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2017 Sathyanesh Krishnan
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
#include <stdio.h>
#include <stdlib.h>
#ifndef _INC_BITPOOL
#define _INC_BITPOOL
class BitPool
{
friend class TestBitPool;
private:
const unsigned mArrayElementBitSizei = sizeof(unsigned)*8;
unsigned mMaxElements;
unsigned *mpBitMaskArray;
public:
BitPool(const unsigned MaxElements);
~BitPool();
protected:
char GetFlag(unsigned BitIndex);
char SetFlag(unsigned BitIndex, unsigned char flag);
private:
unsigned FindMaskArrayIndex(unsigned BitIndex);
char *TestModulePrintBits(const unsigned val);
void TestModulePrintBits2(const char *Buff);
};
#endif // _INC_BITPOOL