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:
parent
1f98639396
commit
013799a4dd
8 changed files with 77 additions and 23 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue