ENDIAN.H(3HEAD) Headers ENDIAN.H(3HEAD)

NAME

endian.hdefinitions for endian routines

SYNOPSIS

#include <endian.h>

DESCRIPTION

The <endian.h> header defines functions and macros focused on converting data between the host machines native byte order and big or little-endian values. While the manual page details the macros defined by <endian.h>, the functions are documented separately in endian(3C). More information on endianness and a general background on the topic can be found in byteorder(5).
The <endian.h> header defines the following macros:
LITTLE_ENDIAN
A constant used to indicate a little-endian integer. It is always defined, regardless of the actual endianess of the underlying platform. This macro should be used to compare against the BYTE_ORDER macro.
BIG_ENDIAN
A constant used to indicate a big-endian integer. It is always defined, regardless of the actual endianess of the underlying platform. This macro should be used to compare against the BYTE_ORDER macro.
PDP_ENDIAN
A constant used to indicate the endianness used for four byte values on the PDP-11. It is always defined, regardless of the actual endianess of the underlying platform. This macro should be used to compare against the BYTE_ORDER macro.
BYTE_ORDER
The value of the BYTE_ORDER macro will be one of LITTLE_ENDIAN or BIG_ENDIAN. At this time, no supported architectures use the byte order indicated by the PDP_ENDIAN macro.
To determine the byte order of a system, one may compare the BYTE_ORDER to one of the aforementioned macros.
In addition to the routines provided by this header, standardized functions may be found in byteorder(3C). The header types.h(3HEAD) also defines additional pre-processor symbols to determine the current endianness of the system.

INTERFACE STABILITY

Committed

SEE ALSO

byteorder(3C), endian(3C), types.h(3HEAD), attributes(5), byteorder(5)
August 2, 2018 illumos