gpu_neon: revive the old tests
[pcsx_rearmed.git] / deps / libchdr / deps / lzma-24.05 / include / Alloc.h
CommitLineData
f535537f 1/* Alloc.h -- Memory allocation functions
22024-01-22 : Igor Pavlov : Public domain */
3
4#ifndef ZIP7_INC_ALLOC_H
5#define ZIP7_INC_ALLOC_H
6
7#include "7zTypes.h"
8
9EXTERN_C_BEGIN
10
11/*
12 MyFree(NULL) : is allowed, as free(NULL)
13 MyAlloc(0) : returns NULL : but malloc(0) is allowed to return NULL or non_NULL
14 MyRealloc(NULL, 0) : returns NULL : but realloc(NULL, 0) is allowed to return NULL or non_NULL
15MyRealloc() is similar to realloc() for the following cases:
16 MyRealloc(non_NULL, 0) : returns NULL and always calls MyFree(ptr)
17 MyRealloc(NULL, non_ZERO) : returns NULL, if allocation failed
18 MyRealloc(non_NULL, non_ZERO) : returns NULL, if reallocation failed
19*/
20
21void *MyAlloc(size_t size);
22void MyFree(void *address);
23void *MyRealloc(void *address, size_t size);
24
25void *z7_AlignedAlloc(size_t size);
26void z7_AlignedFree(void *p);
27
28#ifdef _WIN32
29
30#ifdef Z7_LARGE_PAGES
31void SetLargePageSize(void);
32#endif
33
34void *MidAlloc(size_t size);
35void MidFree(void *address);
36void *BigAlloc(size_t size);
37void BigFree(void *address);
38
39/* #define Z7_BIG_ALLOC_IS_ZERO_FILLED */
40
41#else
42
43#define MidAlloc(size) z7_AlignedAlloc(size)
44#define MidFree(address) z7_AlignedFree(address)
45#define BigAlloc(size) z7_AlignedAlloc(size)
46#define BigFree(address) z7_AlignedFree(address)
47
48#endif
49
50extern const ISzAlloc g_Alloc;
51
52#ifdef _WIN32
53extern const ISzAlloc g_BigAlloc;
54extern const ISzAlloc g_MidAlloc;
55#else
56#define g_BigAlloc g_AlignedAlloc
57#define g_MidAlloc g_AlignedAlloc
58#endif
59
60extern const ISzAlloc g_AlignedAlloc;
61
62
63typedef struct
64{
65 ISzAlloc vt;
66 ISzAllocPtr baseAlloc;
67 unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */
68 size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */
69} CAlignOffsetAlloc;
70
71void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);
72
73
74EXTERN_C_END
75
76#endif