summaryrefslogtreecommitdiff
path: root/Source/Library/Common/Bitset.class.h
blob: 8a0707d1ec1f5e6e85d3a9a63444c72dac5f9a54 (plain) (blame)
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
#ifndef DEF_BITSET_CLASS_H
#define DEF_BITSET_CLASS_H

#include <common.h>

#define INDEX_FROM_BIT(a) (a/(8*4))
#define OFFSET_FROM_BIT(a) (a%(8*4))

class Bitset {
	private:
	u32int m_size;
	u32int *m_data;
	u32int m_usedCount;

	public:
	Bitset();
	Bitset(u32int size);
	Bitset(u32int size, u32int *ptr);
	~Bitset();

	void init(u32int size, u32int *ptr);

	void setBit(u32int number);
	void clearBit(u32int number);
	bool testBit(u32int number);
	u32int firstFreeBit();

	u32int usedBits();
};

#endif