2 * Copyright (c) 2021 M. Warner Losh <imp@FreeBSD.org>
4 * SPDX-License-Identifier: BSD-2-Clause
8 * A mostly Linux/glibc-compatible endian.h
15 * FreeBSD's sys/_endian.h is very close to the interface provided on Linux by
18 #include <sys/_endian.h>
21 * glibc uses double underscore for these symbols. Define these unconditionally.
22 * The compiler defines __BYTE_ORDER__ these days, so we don't do anything
23 * with that since sys/endian.h defines _BYTE_ORDER based on it.
25 #define __BIG_ENDIAN _BIG_ENDIAN
26 #define __BYTE_ORDER _BYTE_ORDER
27 #define __LITTLE_ENDIAN _LITTLE_ENDIAN
28 #define __PDP_ENDIAN _PDP_ENDIAN
31 * FreeBSD's sys/endian.h and machine/endian.h doesn't define a separate
32 * byte order for floats. Use the host non-float byte order.
34 #define __FLOAT_WORD_ORDER _BYTE_ORDER
37 * We don't define BIG_ENDI, LITTLE_ENDI, HIGH_HALF and LOW_HALF macros that
38 * glibc's endian.h defines since those appear to be internal to internal to
39 * glibc. We also don't try to emulate the various helper macros that glibc
40 * uses to limit namespace visibility.
43 #endif /* _ENDIAN_H_ */