1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

LibCrypto+LibJS: Better bitwise binary_xor binop

We went through some trouble to make & and | work right. Reimplement ^
in terms of & and | to make ^ work right as well.

This is less fast than a direct implementation, but let's get things
working first.
This commit is contained in:
Nico Weber 2022-01-17 20:03:51 -05:00 committed by Ali Mohammad Pur
parent 013799a4dd
commit d9b6eb29bc
2 changed files with 3 additions and 8 deletions

View file

@ -526,8 +526,8 @@ TEST_CASE(test_signed_bigint_bitwise_xor)
auto num1 = "-3"_sbigint;
auto num2 = "1"_sbigint;
EXPECT_EQ(num1.bitwise_xor(num1), "0"_sbigint);
EXPECT_EQ(num1.bitwise_xor(num2), "-2"_sbigint);
EXPECT_EQ(num2.bitwise_xor(num1), "-2"_sbigint);
EXPECT_EQ(num1.bitwise_xor(num2), "-4"_sbigint);
EXPECT_EQ(num2.bitwise_xor(num1), "-4"_sbigint);
EXPECT_EQ(num2.bitwise_xor(num2), "0"_sbigint);
}