mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibJS+LibCrypto: Fix SignedBitInteger::bitwise_not and use it in LibJS
Bitwise operators are defined on two's complement, but SignedBitInteger uses sign-magnitude. Correctly convert between the two. Let LibJS delegate to SignedBitInteger for bitwise_not, like it does for all other bitwise_ operations on bigints. No behavior change (LibJS is now the only client of SignedBitInteger::bitwise_not()).
This commit is contained in:
parent
ec37eadb39
commit
945d962322
Notes:
sideshowbarker
2024-07-17 20:40:21 +09:00
Author: https://github.com/nico
Commit: 945d962322
Pull-request: https://github.com/SerenityOS/serenity/pull/11996
Reviewed-by: https://github.com/alimpfard
4 changed files with 15 additions and 5 deletions
|
@ -40,6 +40,8 @@ describe("correct behavior", () => {
|
|||
expect(1n | 2n).toBe(3n);
|
||||
expect(5n ^ 3n).toBe(6n);
|
||||
expect(~1n).toBe(-2n);
|
||||
expect(~-1n).toBe(0n);
|
||||
|
||||
expect(5n << 2n).toBe(20n);
|
||||
expect(7n >> 1n).toBe(3n);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue