Skip to content

Commit ef21b2d

Browse files
committed
micro optimization in EnumSet::doSetBinaryBitsetLeBin()
1 parent fc15efe commit ef21b2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/EnumSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ private function doSetBinaryBitsetLeBin(string $bitset): void
641641
// truncate out-of-range bits of last byte
642642
$lastByteMaxOrd = $this->ordinalMax % 8;
643643
if ($lastByteMaxOrd !== 0) {
644-
$lastByte = $bitset[$size - 1];
644+
$lastByte = $bitset[-1];
645645
$lastByteExpected = \chr((1 << $lastByteMaxOrd) - 1) & $lastByte;
646646
if ($lastByte !== $lastByteExpected) {
647647
throw new InvalidArgumentException('out-of-range bits detected');

0 commit comments

Comments
 (0)