ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
platform_error.h
Go to the documentation of this file.
1// ProtoCore v1.0.16 - Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4/**
5 * @file platform_error.h
6 * @brief The platform's compile-time rules: a bad width stops the build here, naming itself,
7 * instead of at the first expression that assumed it.
8 *
9 * @author Douglas Quigg (dstroy0)
10 * @date 2026
11 */
12
13#ifndef PROTOCORE_PLATFORM_ERROR_H
14#define PROTOCORE_PLATFORM_ERROR_H
15
16#if PROTO_WORD_BITS != 16 && PROTO_WORD_BITS != 32 && PROTO_WORD_BITS != 64
17#error "PROTO_WORD_BITS must be 16, 32 or 64"
18#endif
19#if PROTO_INDEX_BITS != 16 && PROTO_INDEX_BITS != 32
20#error "PROTO_INDEX_BITS must be 16 or 32"
21#endif
22#if PROTO_SWAR_BITS != 8 && PROTO_SWAR_BITS != 16 && PROTO_SWAR_BITS != 32 && PROTO_SWAR_BITS != 64
23#error "PROTO_SWAR_BITS must be 8, 16, 32 or 64"
24#endif
25#if PROTO_INDEX_BITS > PROTO_WORD_BITS
26#error "PROTO_INDEX_BITS exceeds PROTO_WORD_BITS: an index must fit the register it is carried in"
27#endif
28#if PROTO_SWAR_BITS > PROTO_WORD_BITS
29#error "PROTO_SWAR_BITS exceeds PROTO_WORD_BITS: a lane carrier wider than the register is synthesized \
30from halves and is slower than the width it decomposes into"
31#endif
32
33#endif // PROTOCORE_PLATFORM_ERROR_H