mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:38:10 +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
|
@ -40,8 +40,10 @@ describe("correct behavior", () => {
|
|||
expect(3n & -2n).toBe(2n);
|
||||
expect(-3n & -2n).toBe(-4n);
|
||||
expect(-3n & 2n).toBe(0n);
|
||||
expect(0xffff_ffffn & -1n).toBe(0xffff_ffffn);
|
||||
|
||||
expect(1n | 2n).toBe(3n);
|
||||
expect(0n | -1n).toBe(-1n);
|
||||
|
||||
expect(5n ^ 3n).toBe(6n);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue