1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" 12.\" Copyright 2016 Joyent, Inc. 13.\" 14.Dd August 2, 2018 15.Dt ENDIAN.H 3HEAD 16.Os 17.Sh NAME 18.Nm endian.h 19.Nd definitions for endian routines 20.Sh SYNOPSIS 21.In endian.h 22.Sh DESCRIPTION 23The 24.In endian.h 25header defines functions and macros focused on converting data between 26the host machines native byte order and big or little-endian values. 27While the manual page details the macros defined by 28.In endian.h , 29the functions are documented separately in 30.Xr endian 3C . 31More information on endianness and a general background on the topic can 32be found in 33.Xr byteorder 7 . 34.Pp 35The 36.In endian.h 37header defines the following macros: 38.Bl -tag -width Ds 39.It Sy LITTLE_ENDIAN 40A constant used to indicate a little-endian integer. 41It is always defined, regardless of the actual endianess of the underlying 42platform. 43This macro should be used to compare against the 44.Sy BYTE_ORDER 45macro. 46.It Sy BIG_ENDIAN 47A constant used to indicate a big-endian integer. 48It is always defined, regardless of the actual endianess of the underlying 49platform. 50This macro should be used to compare against the 51.Sy BYTE_ORDER 52macro. 53.It Sy PDP_ENDIAN 54A constant used to indicate the endianness used for four byte values on 55the PDP-11. 56It is always defined, regardless of the actual endianess of the underlying 57platform. 58This macro should be used to compare against the 59.Sy BYTE_ORDER 60macro. 61.It Sy BYTE_ORDER 62The value of the 63.Sy BYTE_ORDER 64macro will be one of 65.Sy LITTLE_ENDIAN 66or 67.Sy BIG_ENDIAN . 68At this time, no supported architectures use the byte order indicated by 69the 70.Sy PDP_ENDIAN 71macro. 72.Pp 73To determine the byte order of a system, one may compare the 74.Sy BYTE_ORDER 75to one of the aforementioned macros. 76.El 77.Pp 78In addition to the routines provided by this header, standardized 79functions may be found in 80.Xr byteorder 3C . 81The header 82.Xr types.h 3HEAD 83also defines additional pre-processor symbols to determine the current 84endianness of the system. 85.Sh INTERFACE STABILITY 86.Sy Committed 87.Sh SEE ALSO 88.Xr byteorder 3C , 89.Xr endian 3C , 90.Xr types.h 3HEAD , 91.Xr attributes 7 , 92.Xr byteorder 7 93