We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6639c01 commit 4e60711Copy full SHA for 4e60711
1 file changed
eval_protocol/adapters/r3_deserializer.py
@@ -26,6 +26,7 @@
26
MAGIC = b"R3V1"
27
HEADER_FORMAT = "<4sBBBBIIIIQ"
28
HEADER_SIZE = struct.calcsize(HEADER_FORMAT) # 32 bytes
29
+BITS_PER_BYTE = 8
30
31
32
class _SelectorMode(IntEnum):
@@ -85,8 +86,8 @@ def _read_bitmap_positions(
85
86
"""Return sorted token indices where the bitmap bit is set."""
87
positions: List[int] = []
88
for i in range(total_token_count):
- byte_idx = i >> 3
89
- bit_idx = i & 7
+ byte_idx = i // BITS_PER_BYTE
90
+ bit_idx = i % BITS_PER_BYTE
91
if byte_idx < len(selector_bytes) and (selector_bytes[byte_idx] >> bit_idx) & 1:
92
positions.append(i)
93
return positions
0 commit comments