Skip to content

Commit 1e4e546

Browse files
committed
P0463R1 Endian, just endian
Editorial changes: Added section comment in the synopsis, changed "either ... nor" to "either ... or" in the new paragraph 2.
1 parent 58a489c commit 1e4e546

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

source/utilities.tex

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15478,6 +15478,13 @@
1547815478
template<class... B> struct disjunction;
1547915479
template<class B> struct negation;
1548015480

15481+
// \ref{meta.endian}, endian
15482+
enum class endian {
15483+
little = @\seebelow@,
15484+
big = @\seebelow@,
15485+
native = @\seebelow@
15486+
};
15487+
1548115488
// \ref{meta.unary.cat}, primary type categories
1548215489
template <class T> inline constexpr bool is_void_v
1548315490
= is_void<T>::value;
@@ -17096,6 +17103,42 @@
1709617103
is a \tcode{UnaryTypeTrait} with a base characteristic of \tcode{bool_constant<!bool(B::value)>}.
1709717104
\end{itemdescr}
1709817105

17106+
\rSec2[meta.endian]{Endian}
17107+
17108+
\pnum
17109+
Two common methods of byte ordering in multibyte scalar types are big-endian
17110+
and little-endian in the execution environment. Big-endian is a format for
17111+
storage of binary data in which the most significant byte is placed first,
17112+
with the rest in descending order. Little-endian is a format for storage of
17113+
binary data in which the least significant byte is placed first, with the rest
17114+
in ascending order. This subclause describes the endianness of the scalar types
17115+
of the execution environment.
17116+
17117+
\indexlibrary{\idxcode{endian}}%
17118+
\indexlibrarymember{little}{endian}%
17119+
\indexlibrarymember{big}{endian}%
17120+
\indexlibrarymember{native}{endian}%
17121+
\begin{itemdecl}
17122+
enum class endian {
17123+
little = @\seebelow@,
17124+
big = @\seebelow@,
17125+
native = @\seebelow@
17126+
};
17127+
\end{itemdecl}
17128+
17129+
\begin{itemdescr}
17130+
\pnum
17131+
If all scalar types have size \tcode{1}, then all of \tcode{endian::little},
17132+
\tcode{endian::big}, and \tcode{endian::native} have the same value.
17133+
Otherwise \tcode{endian::little} shall not be equal to \tcode{endian::big}.
17134+
If all scalar types are big-endian, \tcode{endian::native} shall be
17135+
equal to \tcode{endian::big}.
17136+
If all scalar types are little-endian, \tcode{endian::native} shall be
17137+
equal to \tcode{endian::little}.
17138+
Otherwise \tcode{endian::native} shall have a value that is not equal
17139+
to either of \tcode{endian::big} or \tcode{endian::little}.
17140+
\end{itemdescr}
17141+
1709917142
\rSec1[ratio]{Compile-time rational arithmetic}
1710017143

1710117144
\rSec2[ratio.general]{In general}

0 commit comments

Comments
 (0)