protozero: include/protozero/config.hpp Source File

protozero 1.8.2 Minimalistic protocol buffer decoder and encoder in C++.

Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1#ifndef PROTOZERO_CONFIG_HPP
2#define PROTOZERO_CONFIG_HPP
3
4/*****************************************************************************
5
6protozero - Minimalistic protocol buffer decoder and encoder in C++.
7
8This file is from https://github.com/mapbox/protozero where you can find more
9documentation.
10
11*****************************************************************************/
12
13#include <cassert>
14
20
21#define PROTOZERO_LITTLE_ENDIAN 1234
22#define PROTOZERO_BIG_ENDIAN 4321
23
24// Find out which byte order the machine has.
25#if defined(__BYTE_ORDER)
26# if (__BYTE_ORDER == __LITTLE_ENDIAN)
27# define PROTOZERO_BYTE_ORDER PROTOZERO_LITTLE_ENDIAN
28# endif
29# if (__BYTE_ORDER == __BIG_ENDIAN)
30# define PROTOZERO_BYTE_ORDER PROTOZERO_BIG_ENDIAN
31# endif
32#else
33// This probably isn't a very good default, but might do until we figure
34// out something better.
35# define PROTOZERO_BYTE_ORDER PROTOZERO_LITTLE_ENDIAN
36#endif
37
38// Check whether __builtin_bswap is available
39#if defined(__GNUC__) || defined(__clang__)
40# define PROTOZERO_USE_BUILTIN_BSWAP
41#endif
42
43// Wrapper for assert() used for testing
44#ifndef protozero_assert
45# define protozero_assert(x) assert(x)
46#endif
47
48#endif // PROTOZERO_CONFIG_HPP