MCPcopy Create free account
hub / github.com/catboost/catboost / ReverseBitsSlow

Function ReverseBitsSlow

util/generic/bitops_ut.cpp:32–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31template <typename T>
32static T ReverseBitsSlow(T v) {
33 T r = v; // r will be reversed bits of v; first get LSB of v
34 ui32 s = sizeof(v) * 8 - 1; // extra shift needed at end
35
36 for (v >>= 1; v; v >>= 1) {
37 r <<= 1;
38 r |= v & 1;
39 --s;
40 }
41
42 r <<= s; // shift when v's highest bits are zero
43 return r;
44}
45
46// DO_NOT_STYLE
47Y_UNIT_TEST_SUITE(TBitOpsTest) {

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected