| 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */ |
| 2 | #ifndef _LTTNG_ENDIAN_H |
| 3 | #define _LTTNG_ENDIAN_H |
| 4 | |
| 5 | /* |
| 6 | * lttng/endian.h |
| 7 | * |
| 8 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 9 | */ |
| 10 | |
| 11 | #ifdef __KERNEL__ |
| 12 | # include <asm/byteorder.h> |
| 13 | # ifdef __BIG_ENDIAN |
| 14 | # define __BYTE_ORDER __BIG_ENDIAN |
| 15 | # elif defined(__LITTLE_ENDIAN) |
| 16 | # define __BYTE_ORDER __LITTLE_ENDIAN |
| 17 | # else |
| 18 | # error "unknown endianness" |
| 19 | # endif |
| 20 | #ifndef __BIG_ENDIAN |
| 21 | # define __BIG_ENDIAN 4321 |
| 22 | #endif |
| 23 | #ifndef __LITTLE_ENDIAN |
| 24 | # define __LITTLE_ENDIAN 1234 |
| 25 | #endif |
| 26 | #else |
| 27 | # include <endian.h> |
| 28 | #endif |
| 29 | |
| 30 | #endif /* _LTTNG_ENDIAN_H */ |