Skip to content

Commit 4e60711

Browse files
simplify 1 aspect
1 parent 6639c01 commit 4e60711

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

eval_protocol/adapters/r3_deserializer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
MAGIC = b"R3V1"
2727
HEADER_FORMAT = "<4sBBBBIIIIQ"
2828
HEADER_SIZE = struct.calcsize(HEADER_FORMAT) # 32 bytes
29+
BITS_PER_BYTE = 8
2930

3031

3132
class _SelectorMode(IntEnum):
@@ -85,8 +86,8 @@ def _read_bitmap_positions(
8586
"""Return sorted token indices where the bitmap bit is set."""
8687
positions: List[int] = []
8788
for i in range(total_token_count):
88-
byte_idx = i >> 3
89-
bit_idx = i & 7
89+
byte_idx = i // BITS_PER_BYTE
90+
bit_idx = i % BITS_PER_BYTE
9091
if byte_idx < len(selector_bytes) and (selector_bytes[byte_idx] >> bit_idx) & 1:
9192
positions.append(i)
9293
return positions

0 commit comments

Comments
 (0)