Loading...
Searching...
No Matches
config.h
1/*
2 * SPDX-FileCopyrightText: 2019 Koen Zandberg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
14
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#ifndef NANOCBOR_RECURSION_MAX
22#define NANOCBOR_RECURSION_MAX 10
23#endif
24
29#ifndef NANOCBOR_BYTEORDER_HEADER
30#define NANOCBOR_BYTEORDER_HEADER "byteorder.h"
31#endif
32
38#ifndef NANOCBOR_BE64TOH_FUNC
39#define NANOCBOR_BE64TOH_FUNC(be) (ntohll(be))
40#endif
41
47#ifndef NANOCBOR_HTOBE64_FUNC
48#define NANOCBOR_HTOBE64_FUNC(be) (htonll(be))
49#endif
50
56#ifndef NANOCBOR_HTOBE32_FUNC
57#define NANOCBOR_HTOBE32_FUNC(he) htonl(he)
58#endif
59
63#ifndef NANOCBOR_SIZE_SIZET
64#if (SIZE_MAX == UINT16_MAX)
65#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_SHORT
66#elif (SIZE_MAX == UINT32_MAX)
67#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_WORD
68#elif (SIZE_MAX == UINT64_MAX)
69#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_LONG
70#else
71#error ERROR: unable to determine maximum size of size_t
72#endif
73#endif
74
75#ifdef __cplusplus
76}
77#endif