File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed
Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -449,7 +449,7 @@ public function setBinaryBitsetLe($bitset)
449449 if ($ lastByteMaxOrd === 0 ) {
450450 $ this ->bitset = $ bitset ;
451451 } else {
452- $ lastByte = chr ($ lastByteMaxOrd ) & $ bitset [$ size - 1 ];
452+ $ lastByte = chr (( 1 << $ lastByteMaxOrd) - 1 ) & $ bitset [$ size - 1 ];
453453 $ this ->bitset = substr ($ bitset , 0 , -1 ) . $ lastByte ;
454454 }
455455
Original file line number Diff line number Diff line change 99use MabeEnumTest \TestAsset \Enum32 ;
1010use MabeEnumTest \TestAsset \Enum64 ;
1111use MabeEnumTest \TestAsset \Enum65 ;
12+ use MabeEnumTest \TestAsset \Enum66 ;
1213use PHPUnit_Framework_TestCase as TestCase ;
1314
1415/**
@@ -370,8 +371,11 @@ public function testSetBinaryBitsetLe()
370371
371372 public function testSetBinaryBitsetLeTruncateHighBits ()
372373 {
373- $ enumSet = new EnumSet ('MabeEnumTest\TestAsset\Enum65 ' );
374- foreach (Enum65::getEnumerators () as $ enumerator ) {
374+ // using Enum66 to make sure the max. ordinal number gets converted into a bitset
375+ // Enum65 has max. ordinal number of 1 of the last byte. -> 00000001
376+ // Enum66 has max. ordinal number of 2 of the last byte. -> 00000011
377+ $ enumSet = new EnumSet ('MabeEnumTest\TestAsset\Enum66 ' );
378+ foreach (Enum66::getEnumerators () as $ enumerator ) {
375379 $ enumSet ->attach ($ enumerator );
376380 }
377381
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace MabeEnumTest \TestAsset ;
4+
5+ use MabeEnum \Enum ;
6+
7+ /**
8+ * Unit tests for the class MabeEnum\Enum
9+ *
10+ * @link http://github.com/marc-mabe/php-enum for the canonical source repository
11+ * @copyright Copyright (c) 2013 Marc Bennewitz
12+ * @license http://github.com/marc-mabe/php-enum/blob/master/LICENSE.txt New BSD License
13+ */
14+ class Enum66 extends Enum65
15+ {
16+ const SIXTYSIX = 66 ;
17+ }
You can’t perform that action at this time.
0 commit comments