diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-09-16 15:53:42 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-09-16 15:53:42 +0200 |
commit | c161b7d6fe142231346cc1844e6e27c0ab7718c1 (patch) | |
tree | 3fd877b8986137703e987e4651a2db8e946a0f72 /source/luametatex/source/libraries/pplib/util/utilmemallh.h | |
parent | e94fa4dc30ec28a6727aa85e17aaac18b76aeadb (diff) | |
download | context-c161b7d6fe142231346cc1844e6e27c0ab7718c1.tar.gz |
2022-09-16 14:41:00
Diffstat (limited to 'source/luametatex/source/libraries/pplib/util/utilmemallh.h')
-rw-r--r-- | source/luametatex/source/libraries/pplib/util/utilmemallh.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/luametatex/source/libraries/pplib/util/utilmemallh.h b/source/luametatex/source/libraries/pplib/util/utilmemallh.h new file mode 100644 index 000000000..a543d1acb --- /dev/null +++ b/source/luametatex/source/libraries/pplib/util/utilmemallh.h @@ -0,0 +1,36 @@ + +#ifndef UTIL_MEM_ALLH_H +#define UTIL_MEM_ALLH_H + +#include <stddef.h> // size_t +#include <stdint.h> + +#include "utildecl.h" + +typedef struct ghost8 ghost8; +typedef struct ghost16 ghost16; +typedef struct ghost32 ghost32; +typedef struct ghost64 ghost64; + +#define aligned_size8(size) (size) +#define aligned_size16(size) ((((size) + 1) >> 1) << 1) +#define aligned_size32(size) ((((size) + 3) >> 2) << 2) +#define aligned_size64(size) ((((size) + 7) >> 3) << 3) + +#define aligned_space8(size) (size) +#define aligned_space16(size) (((size) & 1) ? ((size) < 0xFFFF ? ((size) + 1) : ((size) - 1)) : (size)) +#define aligned_space32(size) (((size) & 3) ? ((size) < 0xFFFFFFFD ? ((size) - ((size) & 3) + 4) : (size) - ((size) & 3)) : (size)) +#define aligned_space64(size) (((size) & 7) ? ((size) < 0xFFFFFFFFFFFFFFF8ULL ? ((size) - ((size) & 7) + 8) : (size) - ((size) & 7)) : (size)) + +/* info stub */ + +typedef struct { + size_t blocks, singles; + size_t chunks, unused; + size_t used, singleused, left; + size_t ghosts, blockghosts, singleghosts; +} mem_info; + +#define MEM_INFO_INIT() = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +#endif
\ No newline at end of file |