Move to kernel style SPDX license identifiers
[lttng-ust.git] / include / lttng / ust-endian.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * endian.h compatibility layer.
7 */
8
9 #ifndef _LTTNG_UST_ENDIAN_H
10 #define _LTTNG_UST_ENDIAN_H
11
12 #if (defined(__linux__) || defined(__CYGWIN__))
13 #include <endian.h>
14 #include <byteswap.h>
15 #elif defined(__FreeBSD__)
16 #include <sys/endian.h>
17 #define bswap_16(x) bswap16(x)
18 #define bswap_32(x) bswap32(x)
19 #define bswap_64(x) bswap64(x)
20 #else
21 #error "Please add support for your OS."
22 #endif
23
24 /*
25 * BYTE_ORDER, LITTLE_ENDIAN, and BIG_ENDIAN are only defined on Linux
26 * if __USE_BSD is defined. Force their definition.
27 */
28 #ifndef BYTE_ORDER
29 #define BYTE_ORDER __BYTE_ORDER
30 #endif
31
32 #ifndef LITTLE_ENDIAN
33 #define LITTLE_ENDIAN __LITTLE_ENDIAN
34 #endif
35
36 #ifndef BIG_ENDIAN
37 #define BIG_ENDIAN __BIG_ENDIAN
38 #endif
39
40 #ifndef FLOAT_WORD_ORDER
41 #ifdef __FLOAT_WORD_ORDER
42 #define FLOAT_WORD_ORDER __FLOAT_WORD_ORDER
43 #else /* __FLOAT_WORD_ORDER */
44 #define FLOAT_WORD_ORDER BYTE_ORDER
45 #endif /* __FLOAT_WORD_ORDER */
46 #endif /* FLOAT_WORD_ORDER */
47
48 #endif /* _LTTNG_UST_ENDIAN_H */
This page took 0.030944 seconds and 4 git commands to generate.