Loading...
Searching...
No Matches
config.h
1/*
2 * Copyright (C) 2019 Koen Zandberg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
16#ifndef NANOCBOR_CONFIG_H
17#define NANOCBOR_CONFIG_H
18
19#include <stdint.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#ifndef NANOCBOR_RECURSION_MAX
26#define NANOCBOR_RECURSION_MAX 10
27#endif
28
33#ifndef NANOCBOR_BYTEORDER_HEADER
34#define NANOCBOR_BYTEORDER_HEADER "byteorder.h"
35#endif
36
42#ifndef NANOCBOR_BE64TOH_FUNC
43#define NANOCBOR_BE64TOH_FUNC(be) (ntohll(be))
44#endif
45
51#ifndef NANOCBOR_HTOBE64_FUNC
52#define NANOCBOR_HTOBE64_FUNC(be) (htonll(be))
53#endif
54
60#ifndef NANOCBOR_HTOBE32_FUNC
61#define NANOCBOR_HTOBE32_FUNC(he) htonl(he)
62#endif
63
67#ifndef NANOCBOR_SIZE_SIZET
68#if (SIZE_MAX == UINT16_MAX)
69#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_SHORT
70#elif (SIZE_MAX == UINT32_MAX)
71#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_WORD
72#elif (SIZE_MAX == UINT64_MAX)
73#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_LONG
74#else
75#error ERROR: unable to determine maximum size of size_t
76#endif
77#endif
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif /* NANOCBOR_CONFIG_H */