Skip to content

Commit ab9376d

Browse files
committed
xor filter 12 bit: tiny speedup
1 parent 4a01f70 commit ab9376d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/nbit_array.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class UInt12Array {
4848
// the returned value may contain other high-order bits;
4949
// call mask() to clear them
5050
inline uint32_t get(size_t index) {
51-
size_t firstBytePos = (index >> 1) + index;
52-
uint32_t word;
53-
memcpy(&word, data + firstBytePos, sizeof(uint32_t));
51+
size_t firstBytePos = (index * 3) / 2;
52+
uint16_t word;
53+
memcpy(&word, data + firstBytePos, sizeof(uint16_t));
5454
return word >> ((index & 1) << 2);
5555
}
5656

0 commit comments

Comments
 (0)