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

Function Rot

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

Source from the content-addressed store, hash-verified

347// Rotate bits.
348template <typename T, bool left>
349inline static T Rot(T opnd, int distance) {
350 int mask = BitSizeOf<T>() - 1;
351 int unsigned_right_shift = left ? (-distance & mask) : (distance & mask);
352 int signed_left_shift = left ? (distance & mask) : (-distance & mask);
353 using unsigned_type = typename std::make_unsigned<T>::type;
354 return (static_cast<unsigned_type>(opnd) >> unsigned_right_shift) | (opnd << signed_left_shift);
355}
356
357// TUNING: use rbit for arm/arm64
358inline static uint32_t ReverseBits32(uint32_t opnd) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected