]>
Commit | Line | Data |
---|---|---|
30fdf114 | 1 | /* Alloc.h -- Memory allocation functions\r |
5ec5a236 | 2 | 2018-02-19 : Igor Pavlov : Public domain */\r |
30fdf114 LG |
3 | \r |
4 | #ifndef __COMMON_ALLOC_H\r | |
5 | #define __COMMON_ALLOC_H\r | |
6 | \r | |
c4ab09ef LG |
7 | #include "7zTypes.h"\r |
8 | \r | |
9 | EXTERN_C_BEGIN\r | |
30fdf114 LG |
10 | \r |
11 | void *MyAlloc(size_t size);\r | |
12 | void MyFree(void *address);\r | |
13 | \r | |
14 | #ifdef _WIN32\r | |
15 | \r | |
16 | void SetLargePageSize();\r | |
17 | \r | |
18 | void *MidAlloc(size_t size);\r | |
19 | void MidFree(void *address);\r | |
20 | void *BigAlloc(size_t size);\r | |
21 | void BigFree(void *address);\r | |
22 | \r | |
23 | #else\r | |
24 | \r | |
25 | #define MidAlloc(size) MyAlloc(size)\r | |
26 | #define MidFree(address) MyFree(address)\r | |
27 | #define BigAlloc(size) MyAlloc(size)\r | |
28 | #define BigFree(address) MyFree(address)\r | |
29 | \r | |
30 | #endif\r | |
31 | \r | |
5ec5a236 LG |
32 | extern const ISzAlloc g_Alloc;\r |
33 | extern const ISzAlloc g_BigAlloc;\r | |
34 | extern const ISzAlloc g_MidAlloc;\r | |
35 | extern const ISzAlloc g_AlignedAlloc;\r | |
36 | \r | |
37 | \r | |
38 | typedef struct\r | |
39 | {\r | |
40 | ISzAlloc vt;\r | |
41 | ISzAllocPtr baseAlloc;\r | |
42 | unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */\r | |
43 | size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */\r | |
44 | } CAlignOffsetAlloc;\r | |
45 | \r | |
46 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);\r | |
47 | \r | |
c4ab09ef LG |
48 | \r |
49 | EXTERN_C_END\r | |
50 | \r | |
30fdf114 | 51 | #endif\r |