Skip to content

Commit 6dfc32e

Browse files
authored
Merge 2019-07 LWG Motion 17
P1612R1 Relocate endian’s specification Fixes #3021.
2 parents 1ea45af + e63c8d4 commit 6dfc32e

File tree

3 files changed

+45
-43
lines changed

3 files changed

+45
-43
lines changed

source/numerics.tex

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,13 @@
13171317
constexpr int countr_one(T x) noexcept;
13181318
template<class T>
13191319
constexpr int popcount(T x) noexcept;
1320+
1321+
// \ref{bit.endian}, endian
1322+
enum class endian {
1323+
little = @\seebelow@,
1324+
big = @\seebelow@,
1325+
native = @\seebelow@
1326+
};
13201327
}
13211328
\end{codeblock}
13221329

@@ -1598,6 +1605,42 @@
15981605
The number of \tcode{1} bits in the value of \tcode{x}.
15991606
\end{itemdescr}
16001607

1608+
\rSec2[bit.endian]{Endian}
1609+
1610+
\pnum
1611+
Two common methods of byte ordering in multibyte scalar types are big-endian
1612+
and little-endian in the execution environment. Big-endian is a format for
1613+
storage of binary data in which the most significant byte is placed first,
1614+
with the rest in descending order. Little-endian is a format for storage of
1615+
binary data in which the least significant byte is placed first, with the rest
1616+
in ascending order. This subclause describes the endianness of the scalar types
1617+
of the execution environment.
1618+
1619+
\indexlibrary{\idxcode{endian}}%
1620+
\indexlibrarymember{little}{endian}%
1621+
\indexlibrarymember{big}{endian}%
1622+
\indexlibrarymember{native}{endian}%
1623+
\begin{itemdecl}
1624+
enum class endian {
1625+
little = @\seebelow@,
1626+
big = @\seebelow@,
1627+
native = @\seebelow@
1628+
};
1629+
\end{itemdecl}
1630+
1631+
\begin{itemdescr}
1632+
\pnum
1633+
If all scalar types have size 1 byte, then all of \tcode{endian::little},
1634+
\tcode{endian::big}, and \tcode{endian::native} have the same value.
1635+
Otherwise, \tcode{endian::little} is not equal to \tcode{endian::big}.
1636+
If all scalar types are big-endian, \tcode{endian::native} is
1637+
equal to \tcode{endian::big}.
1638+
If all scalar types are little-endian, \tcode{endian::native} is
1639+
equal to \tcode{endian::little}.
1640+
Otherwise, \tcode{endian::native} is not equal
1641+
to either \tcode{endian::big} or \tcode{endian::little}.
1642+
\end{itemdescr}
1643+
16011644
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16021645
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16031646
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

source/support.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@
590590
\tcode{<new>} \\ \rowsep
591591
\defnlibxname{cpp_lib_enable_shared_from_this} & \tcode{201603L} &
592592
\tcode{<memory>} \\ \rowsep
593+
\defnlibxname{cpp_lib_endian} & \tcode{201907L} &
594+
\tcode{<bit>} \\ \rowsep
593595
\defnlibxname{cpp_lib_erase_if} & \tcode{201811L} &
594596
\tcode{<string>} \tcode{<deque>} \tcode{<forward_list>} \tcode{<list>}
595597
\tcode{<vector>} \tcode{<map>} \tcode{<set>} \tcode{<unordered_map>}

source/utilities.tex

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16506,13 +16506,6 @@
1650616506
template<class... B> struct disjunction;
1650716507
template<class B> struct negation;
1650816508

16509-
// \ref{meta.endian}, endian
16510-
enum class endian {
16511-
little = @\seebelow@,
16512-
big = @\seebelow@,
16513-
native = @\seebelow@
16514-
};
16515-
1651616509
// \ref{meta.unary.cat}, primary type categories
1651716510
template<class T>
1651816511
inline constexpr bool is_void_v = is_void<T>::value;
@@ -18330,42 +18323,6 @@
1833018323
is a \oldconcept{UnaryTypeTrait} with a base characteristic of \tcode{bool_constant<!bool(B::\brk{}value)>}.
1833118324
\end{itemdescr}
1833218325

18333-
\rSec2[meta.endian]{Endian}
18334-
18335-
\pnum
18336-
Two common methods of byte ordering in multibyte scalar types are big-endian
18337-
and little-endian in the execution environment. Big-endian is a format for
18338-
storage of binary data in which the most significant byte is placed first,
18339-
with the rest in descending order. Little-endian is a format for storage of
18340-
binary data in which the least significant byte is placed first, with the rest
18341-
in ascending order. This subclause describes the endianness of the scalar types
18342-
of the execution environment.
18343-
18344-
\indexlibrary{\idxcode{endian}}%
18345-
\indexlibrarymember{little}{endian}%
18346-
\indexlibrarymember{big}{endian}%
18347-
\indexlibrarymember{native}{endian}%
18348-
\begin{itemdecl}
18349-
enum class endian {
18350-
little = @\seebelow@,
18351-
big = @\seebelow@,
18352-
native = @\seebelow@
18353-
};
18354-
\end{itemdecl}
18355-
18356-
\begin{itemdescr}
18357-
\pnum
18358-
If all scalar types have size 1 byte, then all of \tcode{endian::little},
18359-
\tcode{endian::big}, and \tcode{endian::native} have the same value.
18360-
Otherwise, \tcode{endian::little} is not equal to \tcode{endian::big}.
18361-
If all scalar types are big-endian, \tcode{endian::native} is
18362-
equal to \tcode{endian::big}.
18363-
If all scalar types are little-endian, \tcode{endian::native} is
18364-
equal to \tcode{endian::little}.
18365-
Otherwise, \tcode{endian::native} is not equal
18366-
to either \tcode{endian::big} or \tcode{endian::little}.
18367-
\end{itemdescr}
18368-
1836918326
\rSec2[meta.const.eval]{Constant evaluation context}
1837018327
\begin{itemdecl}
1837118328
constexpr bool is_constant_evaluated() noexcept;

0 commit comments

Comments
 (0)