tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1836708.js (517B)


      1 // Testing i64.mul in wasm with a 2 ** n +- 1 value as operand, which may
      2 // be optimized in code generation.
      3 var mulImmOperands = [];
      4 
      5 for (let i = 0n; i < 64n; i++) {
      6  mulImmOperands.push(2n ** i - 1n);
      7  mulImmOperands.push(2n ** i + 1n);
      8 }
      9 
     10 for (const immVal of mulImmOperands) {
     11  const ins = wasmEvalText(`(module
     12    (func (export "mul_i64") (param i64) (result i64)
     13      local.get 0
     14      i64.const ${immVal}
     15      i64.mul
     16    ))`);
     17 
     18  assertEq(ins.exports.mul_i64(42n), BigInt.asIntN(64, 42n * immVal));
     19 }