Fix
[ryzomcore.git] / nel / 3rdparty / seven_zip / Alloc.h
blob648237646f29cc545eb7ed728aaa5f845e1ab761
1 /* Alloc.h -- Memory allocation functions
2 2018-02-19 : Igor Pavlov : Public domain */
4 #ifndef __COMMON_ALLOC_H
5 #define __COMMON_ALLOC_H
7 #include "7zTypes.h"
9 EXTERN_C_BEGIN
11 void *MyAlloc(size_t size);
12 void MyFree(void *address);
14 #ifdef _WIN32
16 void SetLargePageSize();
18 void *MidAlloc(size_t size);
19 void MidFree(void *address);
20 void *BigAlloc(size_t size);
21 void BigFree(void *address);
23 #else
25 #define MidAlloc(size) MyAlloc(size)
26 #define MidFree(address) MyFree(address)
27 #define BigAlloc(size) MyAlloc(size)
28 #define BigFree(address) MyFree(address)
30 #endif
32 extern const ISzAlloc g_Alloc;
33 extern const ISzAlloc g_BigAlloc;
34 extern const ISzAlloc g_MidAlloc;
35 extern const ISzAlloc g_AlignedAlloc;
38 typedef struct
40 ISzAlloc vt;
41 ISzAllocPtr baseAlloc;
42 unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */
43 size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */
44 } CAlignOffsetAlloc;
46 void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);
49 EXTERN_C_END
51 #endif