1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:27:44 +00:00

LibCrypto+LibJS: Better bigint bitwise_or binop

Similar to the bitwise_and change, but we have to be careful to
sign-extend two's complement numbers only up to the highest set bit
in the positive number.
This commit is contained in:
Nico Weber 2022-01-18 08:46:42 -05:00 committed by Ali Mohammad Pur
parent 1f98639396
commit 013799a4dd
8 changed files with 77 additions and 23 deletions

View file

@ -2996,7 +2996,7 @@ static void bigint_signed_bitwise()
I_TEST((Signed BigInteger | Bitwise or handles sign));
auto num1 = "-1234567"_sbigint;
auto num2 = "1234567"_sbigint;
if (num1.bitwise_or(num2) == num1) {
if (num1.bitwise_or(num2) == "-1"_sbigint) {
PASS;
} else {
FAIL(Invalid value);