MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / BSWAP

Function BSWAP

Bcore/src/main/cpp/base/bit_utils.h:94–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92// Swap bytes.
93template<typename T>
94constexpr T BSWAP(T x) {
95 if (sizeof(T) == sizeof(uint16_t)) {
96 return __builtin_bswap16(x);
97 } else if (sizeof(T) == sizeof(uint32_t)) {
98 return __builtin_bswap32(x);
99 } else {
100 return __builtin_bswap64(x);
101 }
102}
103
104// Find the bit position of the most significant bit (0-based), or -1 if there were no bits set.
105template <typename T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected