Debian Codegraph @

libs/pplib/pplib-src/src/util/utilmemallh.h

raw
1
2 #ifndef UTIL_MEM_ALLH_H
3 #define UTIL_MEM_ALLH_H
4
5 #include <stddef.h> // size_t
6 #include <stdint.h>
7
8 #include "utildecl.h"
9
10 typedef struct ghost8 ghost8;
11 typedef struct ghost16 ghost16;
12 typedef struct ghost32 ghost32;
13 typedef struct ghost64 ghost64;
14
15 #define aligned_size8(size) (size)
16 #define aligned_size16(size) ((((size) + 1) >> 1) << 1)
17 #define aligned_size32(size) ((((size) + 3) >> 2) << 2)
18 #define aligned_size64(size) ((((size) + 7) >> 3) << 3)
19
20 #define aligned_space8(size) (size)
21 #define aligned_space16(size) (((size) & 1) ? ((size) < 0xFFFF ? ((size) + 1) : ((size) - 1)) : (size))
22 #define aligned_space32(size) (((size) & 3) ? ((size) < 0xFFFFFFFD ? ((size) - ((size) & 3) + 4) : (size) - ((size) & 3)) : (size))
23 #define aligned_space64(size) (((size) & 7) ? ((size) < 0xFFFFFFFFFFFFFFF8ULL ? ((size) - ((size) & 7) + 8) : (size) - ((size) & 7)) : (size))
24
25 /* info stub */
26
27 typedef struct {
28 size_t blocks, singles;
29 size_t chunks, unused;
30 size_t used, singleused, left;
31 size_t ghosts, blockghosts, singleghosts;
32 } mem_info;
33
34 #define MEM_INFO_INIT() = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
35
36 #endif