Unleashed v1.4
[unleashed.git] / share / man / man3head / endian.h.3head
blob30466d56af9616967c0829d2bd189b4344c48c36
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
23 The
24 .In endian.h
25 header defines functions and macros focused on converting data between
26 the host machines native byte order and big or little-endian values.
27 While the manual page details the macros defined by
28 .In endian.h ,
29 the functions are documented separately in
30 .Xr endian 3.
31 More information on endianness and a general background on the topic can
32 be found in
33 .Xr byteorder 5 .
34 .Pp
35 The
36 .In endian.h
37 header defines the following macros:
38 .Bl -tag -width Ds
39 .It Sy LITTLE_ENDIAN
40 A constant used to indicate a little-endian integer.
41 It is always defined, regardless of the actual endianess of the underlying
42 platform.
43 This macro should be used to compare against the
44 .Sy BYTE_ORDER
45 macro.
46 .It Sy BIG_ENDIAN
47 A constant used to indicate a big-endian integer.
48 It is always defined, regardless of the actual endianess of the underlying
49 platform.
50 This macro should be used to compare against the
51 .Sy BYTE_ORDER
52 macro.
53 .It Sy PDP_ENDIAN
54 A constant used to indicate the endianness used for four byte values on
55 the PDP-11.
56 It is always defined, regardless of the actual endianess of the underlying
57 platform.
58 This macro should be used to compare against the
59 .Sy BYTE_ORDER
60 macro.
61 .It Sy BYTE_ORDER
62 The value of the
63 .Sy BYTE_ORDER
64 macro will be one of
65 .Sy LITTLE_ENDIAN
67 .Sy BIG_ENDIAN .
68 At this time, no supported architectures use the byte order indicated by
69 the
70 .Sy PDP_ENDIAN
71 macro.
72 .Pp
73 To determine the byte order of a system, one may compare the
74 .Sy BYTE_ORDER
75 to one of the aforementioned macros.
76 .El
77 .Pp
78 In addition to the routines provided by this header, standardized
79 functions may be found in
80 .Xr byteorder 3 .
81 The header
82 .Xr types.h 3HEAD
83 also defines additional pre-processor symbols to determine the current
84 endianness of the system.
85 .Sh INTERFACE STABILITY
86 .Sy Committed
87 .Sh SEE ALSO
88 .Xr byteorder 3 ,
89 .Xr endian 3 ,
90 .Xr types.h 3HEAD ,
91 .Xr attributes 5 ,
92 .Xr byteorder 5