A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/numeric/byteswap below:

std::byteswap - cppreference.com

template< class T >
constexpr T byteswap( T n ) noexcept;

(since C++23)

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.

[edit] Parameters [edit] Return value

An integer value of type T whose object representation comprises the bytes of that of n in reversed order.

[edit] Notes

This function is useful for processing data of different endianness.

[edit] Possible implementation [edit] Example

Possible 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
(enum) [edit] computes the result of bitwise left-rotation
(function template) [edit] computes the result of bitwise right-rotation
(function template) [edit]

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