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