◐ Shell
reader mode source ↗
From cppreference.com
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
Defined in header <bit>
template< class T >
constexpr T bit_reverse( T x ) noexcept;

Returns x with the order of the bits reversed.

This overload participates in overload resolution only if T is an unsigned integer type (that is, unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, or an extended unsigned integer type).

Parameters

x - value of unsigned integer type

Return value

x with the order of the bits reversed.

Notes

The function is typically implemented using an intrinsic such as Clang's __builtin_bitreverse, and has the same effect as the rbit instruction on ARM CPUs.

Feature-test macro Value Std Feature
__cpp_lib_bitops 202606L (C++29) Bit permutations