xref: /titanic_51/usr/src/man/man3head/endian.h.3head (revision 174bc6499d233e329ecd3d98a880a7b07df16bfa)
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 January 30, 2016
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 5 .
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. It is always
41defined, regardless of the actual endianess of the underlying platform.
42This macro should be used to compare against the
43.Sy BYTE_ORDER
44macro.
45.It Sy BIG_ENDIAN
46A constant used to indicate a big-endian integer. It is always defined,
47regardless of the actual endianess of the underlying platform. This
48macro should be used to compare against the
49.Sy BYTE_ORDER
50macro.
51.It Sy PDP_ENDIAN
52A constant used to indicate the endianness used for four byte values on
53the PDP-11. It is always defined, regardless of the actual endianess of
54the underlying platform. This macro should be used to compare against
55the
56.Sy BYTE_ORDER
57macro.
58.It Sy BYTE_ORDER
59The value of the
60.Sy BYTE_ORDER
61macro will be one of
62.Sy LITTLE_ENDIAN
63or
64.Sy BIG_ENDIAN .
65At this time, no supported architectures use the byte order indicated by
66the
67.Sy PDP_ENDIAN
68macro.
69.Pp
70To determine the byte order of a system, one may compare the
71.Sy BYTE_ORDER
72to one of the aforementioned macros.
73.El
74.Pp
75In addition to the routines provided by this header, standardized
76functions may be found in
77.Xr byteorder 3C .
78The header
79.Xr types.h 3HEAD
80also defines additional pre-processor symbols to determine the current
81endianness of the system.
82.Sh INTERFACE STABILITY
83.Sy Committed
84.Sh SEE ALSO
85.Xr endian 3C ,
86.Xr types.h 3HEAD ,
87.Xr attributes 5 ,
88.Xr byteorder 5
89