blob: 6bd4e39ba6ba58cf3ae44ff83ffb2b7cc09fc99a [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function mul(a, b) {
return a * b;
}
noInline(mul);
{
for (var i = 0; i < 100000; ++i)
shouldBe(mul(BigInt(i), 2n), BigInt(i * 2));
}
{
let max = 0x7fffffffn;
let result = 0xfffffffen;
for (var i = 0; i < 100000; ++i)
shouldBe(mul(max, 2n), result);
}