template< class T >
constexpr T byteswap( T n ) noexcept;
Reverses the bytes in the given integer value n.
std::byteswap
participates in overload resolution only if T
satisfies integral
, i.e., T
is an integer type. The program is ill-formed if T
has padding bits.
An integer value of type T
whose object representation comprises the bytes of that of n in reversed order.
This function is useful for processing data of different endianness.
[edit] Possible implementation [edit] ExamplePossible output:
byteswap for U16: CAFE : FE CA FECA : CA FE byteswap for U32: DEADBEEF : EF BE AD DE EFBEADDE : DE AD BE EF byteswap for U64: 0123456789ABCDEF : EF CD AB 89 67 45 23 01 EFCDAB8967452301 : 01 23 45 67 89 AB CD EF[edit] See also indicates the endianness of scalar types
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3