MCPcopy Create free account
hub / github.com/apache/arrow / ReverseUint8

Function ReverseUint8

cpp/src/arrow/util/bitmap_ops.cc:112–117  ·  view source on GitHub ↗

Reverse all bits from entire byte(uint8)

Source from the content-addressed store, hash-verified

110
111// Reverse all bits from entire byte(uint8)
112uint8_t ReverseUint8(uint8_t num) {
113 num = ((num & 0xf0) >> 4) | ((num & 0x0f) << 4);
114 num = ((num & 0xcc) >> 2) | ((num & 0x33) << 2);
115 num = ((num & 0xaa) >> 1) | ((num & 0x55) << 1);
116 return num;
117}
118
119// Get a reverse block of byte(uint8) using offsets, the result can be
120// part of a left block and right block, length indicates the number of bits

Callers 1

GetReversedBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected