Commit 28078040 authored by Anton Smirnov's avatar Anton Smirnov
Browse files

Fix is_bit_set bug

parent 0a62dc74
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -666,7 +666,7 @@ namespace Arokettu\Unsigned
        $bit &= 7;
        $bitmask = 1 << $bit;

        return (\ord($a[$byte]) & $bitmask) > 1;
        return (\ord($a[$byte]) & $bitmask) !== 0;
    }
}

+12 −0
Original line number Diff line number Diff line
@@ -240,6 +240,18 @@ class ArithmeticTest extends TestCase
                from_hex('112210f47de98116', 8)  // 1234567890123456790
            ))
        );

        // big pow2
        self::assertEquals(
            [
                from_hex('112233', 16),
                from_hex('445566778899aabbccddeeff00', 16),
            ],
            div_mod(
                from_hex('112233445566778899aabbccddeeff00', 16),
                from_hex('00000100000000000000000000000000', 16)
            )
        );
    }

    public function testDivDifferentSizes()