-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsizeIndex.h
44 lines (30 loc) · 808 Bytes
/
sizeIndex.h
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
34
35
36
37
38
39
40
41
42
43
44
#ifndef MY_MALLOC_SIZEINDEX_H
#define MY_MALLOC_SIZEINDEX_H
#include "pages.h"
#include "global.h"
/**
* A class containing an array of lists for handling objects of specific size
*/
class SizeIndex {
PageList* indexArray[8]; /** The array of lists */
/*
* indexArray[0] : 32
* indexArray[1] : 64
* indexArray[2] : 128
* indexArray[3] : 256
* indexArray[4] : 512
* indexArray[5] : 1024
* indexArray[6] : 2048
* indexArray[7] : 4096
*/
/**
* Find the appropriate array index for a given size
* @param size the size of the object
* @return An index from 0 to 7 for the appropriate cell
*/
int indexOf(int size);
public:
SizeIndex();
PageList* getPageList(size_t size);
};
#endif //MY_MALLOC_SIZEINDEX_H