12#include "config/mmgr_compiler_directives.h"
19typedef uint8_t mmgr_u8;
20typedef uint16_t mmgr_u16;
21typedef uint32_t mmgr_u32;
22typedef uint64_t mmgr_u64;
23typedef int8_t mmgr_i8;
24typedef int16_t mmgr_i16;
25typedef int32_t mmgr_i32;
26typedef int64_t mmgr_i64;
32typedef bool mmgr_bool;
35typedef _Bool mmgr_bool;
41#define MMGR_TRUE ((mmgr_bool)1)
42#define MMGR_FALSE ((mmgr_bool)0)
49#if !defined(MMGR_WORD_BITS) || !defined(MMGR_INDEX_BITS)
50#error "mmgr_types.h is not a standalone header - include mmgr_config.h, which sets the widths first"
59#if MMGR_WORD_BITS == 64
61typedef mmgr_u64 mmgr_word;
63typedef mmgr_i64 mmgr_iword;
64#elif MMGR_WORD_BITS == 32
65typedef mmgr_u32 mmgr_word;
66typedef mmgr_i32 mmgr_iword;
67#elif MMGR_WORD_BITS == 16
68typedef mmgr_u16 mmgr_word;
69typedef mmgr_i16 mmgr_iword;
71#error "MMGR_WORD_BITS must be 16, 32 or 64 - see mmgr_config.h"
80#if MMGR_INDEX_BITS == 32
82typedef mmgr_u32 mmgr_idx;
83#elif MMGR_INDEX_BITS == 16
84typedef mmgr_u16 mmgr_idx;
86#error "MMGR_INDEX_BITS must be 16 or 32 - see mmgr_config.h"
94MMGR_STATIC_ASSERT(
sizeof(mmgr_u8) == 1,
"mmgr_u8 must be exactly 8 bits: this target has no 8-bit type");
95MMGR_STATIC_ASSERT(
sizeof(mmgr_u16) * 8u == 16u,
"mmgr_u16 must be exactly 16 bits");
96MMGR_STATIC_ASSERT(
sizeof(mmgr_u32) * 8u == 32u,
"mmgr_u32 must be exactly 32 bits");
97MMGR_STATIC_ASSERT(
sizeof(mmgr_u64) * 8u == 64u,
"mmgr_u64 must be exactly 64 bits");
98MMGR_STATIC_ASSERT(
sizeof(mmgr_word) * 8u == MMGR_WORD_BITS,
"mmgr_word must be exactly MMGR_WORD_BITS wide");
99MMGR_STATIC_ASSERT(
sizeof(mmgr_iword) ==
sizeof(mmgr_word),
"the signed word must be the same register as the word");
100MMGR_STATIC_ASSERT(
sizeof(mmgr_idx) * 8u == MMGR_INDEX_BITS,
"mmgr_idx must be exactly MMGR_INDEX_BITS wide");
101MMGR_STATIC_ASSERT(
sizeof(mmgr_idx) <=
sizeof(mmgr_word),
"an index must fit the register it is carried in");
109typedef enum MMGR_ENUM_PACKED
111 MMGR_ENUM_PROBE_MIN = 0,
112 MMGR_ENUM_PROBE_MAX = 255,
114MMGR_STATIC_ASSERT(
sizeof(MmgrEnumProbe) == 1,
115 "MMGR_ENUM_PACKED is not honored here, so no enum keeps its declared width and every "
116 "borrow offset computed from a struct containing one is wrong (TI: pass --small_enum)");