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
9#pragma once
10
17
18#include <stdint.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#ifndef NANOCBOR_RECURSION_MAX
25#define NANOCBOR_RECURSION_MAX 10
26#endif
27
32#ifndef NANOCBOR_BYTEORDER_HEADER
33#define NANOCBOR_BYTEORDER_HEADER "byteorder.h"
34#endif
35
41#ifndef NANOCBOR_BE64TOH_FUNC
42#define NANOCBOR_BE64TOH_FUNC(be) (ntohll(be))
43#endif
44
50#ifndef NANOCBOR_HTOBE64_FUNC
51#define NANOCBOR_HTOBE64_FUNC(be) (htonll(be))
52#endif
53
59#ifndef NANOCBOR_HTOBE32_FUNC
60#define NANOCBOR_HTOBE32_FUNC(he) htonl(he)
61#endif
62
66#ifndef NANOCBOR_SIZE_SIZET
67#if (SIZE_MAX == UINT16_MAX)
68#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_SHORT
69#elif (SIZE_MAX == UINT32_MAX)
70#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_WORD
71#elif (SIZE_MAX == UINT64_MAX)
72#define NANOCBOR_SIZE_SIZET NANOCBOR_SIZE_LONG
73#else
74#error ERROR: unable to determine maximum size of size_t
75#endif
76#endif
77
78#ifdef __cplusplus
79}
80#endif