30#ifndef PROTOCORE_TYPES_H
31#define PROTOCORE_TYPES_H
67#define PROTO_TRUE ((proto_bool)1)
68#define PROTO_FALSE ((proto_bool)0)
80#define PROTO_ATOMIC_LOAD(p) atomic_load_explicit((p), memory_order_acquire)
81#define PROTO_ATOMIC_STORE(p, v) atomic_store_explicit((p), (v), memory_order_release)
91#define PROTOCORE_BEGIN_DECLS \
94#define PROTOCORE_END_DECLS }
96#define PROTOCORE_BEGIN_DECLS
97#define PROTOCORE_END_DECLS
113#if defined(__GNUC__) || defined(__clang__)
114#define PROTO_ENUM_PACKED __attribute__((packed))
116#define PROTO_ENUM_PACKED
125#if PROTO_WORD_BITS == 64
127#elif PROTO_WORD_BITS == 32
129#elif PROTO_WORD_BITS == 16
132#error "PROTO_WORD_BITS must be 16, 32 or 64 - see protocore_config.h"
142#if PROTO_INDEX_BITS == 32
144#elif PROTO_INDEX_BITS == 16
147#error "PROTO_INDEX_BITS must be 16 or 32 - see protocore_config.h"
157static_assert(
sizeof(
proto_u8) == 1,
"proto_u8 must be exactly 8 bits: this target has no 8-bit type");
158static_assert(
sizeof(
proto_u16) * 8u == 16u,
"proto_u16 must be exactly 16 bits");
159static_assert(
sizeof(
proto_u32) * 8u == 32u,
"proto_u32 must be exactly 32 bits");
160static_assert(
sizeof(
proto_u64) * 8u == 64u,
"proto_u64 must be exactly 64 bits");
161static_assert(
sizeof(proto_word) * 8u ==
PROTO_WORD_BITS,
"proto_word must be exactly PROTO_WORD_BITS wide");
162static_assert(
sizeof(proto_idx) * 8u ==
PROTO_INDEX_BITS,
"proto_idx must be exactly PROTO_INDEX_BITS wide");
163static_assert(
sizeof(proto_idx) <=
sizeof(proto_word),
"an index must fit the register it is carried in");
174 "PROTO_ENUM_PACKED is not honored here, so no enum keeps its declared width (TI: pass --small_enum)");
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
_Bool proto_bool
The truth value.
enum PROTO_ENUM_PACKED proto_enum_probe
The natural register width, as a type.