summaryrefslogtreecommitdiff
path: root/Source/Kernel/Library/Bitset.class.h
blob: 75fde24a27546953dab585ce4d5ec8150b7fe867 (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 <Core/common.wtf.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