How to use INT32_MIN method in wpt

Best JavaScript code snippet using wpt

testExpressions.js

Source:testExpressions.js Github

copy

Full Screen

1load(libdir + "asm.js");2assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i+j)|0 } return f");3assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i+j)|0 } return f");4assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i-j)|0 } return f");5assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i-j)|0 } return f");6assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i*j)|0 } return f");7assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i*j)|0 } return f");8assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0; return (i*j)|0 } return f");9assertAsmTypeFail(USE_ASM + "function f() { var i=0; return (i*1048576)|0 } return f");10assertAsmTypeFail(USE_ASM + "function f() { var i=0; return (i*-1048576)|0 } return f");11assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0; return (i + (j*4))|0 } return f");12assertAsmTypeFail(USE_ASM + "function f() { var two30 = 1073741824; return (((two30 * 524288 * 16) + 1) & 1)|0 } return f");13assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i/j)|0 } return f");14assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i/j)|0 } return f");15assertAsmTypeFail(USE_ASM + "function f() { var i=1,j=1; return (i/j)|0 } return f");16assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i%j)|0 } return f");17assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i%j)|0 } return f");18assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i<j)|0 } return f");19assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i<j)|0 } return f");20assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0; return (i<j)|0 } return f");21assertAsmTypeFail(USE_ASM + "function f() { var i=0.0; return (-i)|0 } return f");22assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0; return (-(i+j))|0 } return f");23assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i|0)/(k|0) } return f");24assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i>>>0)/(k>>>0) } return f");25assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i|0)%(k|0) } return f");26assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i>>>0)%(k>>>0) } return f");27const UINT32_MAX = Math.pow(2,32)-1;28const INT32_MIN = -Math.pow(2,31);29const INT32_MAX = Math.pow(2,31)-1;30var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return (i*2)|0 } return f"));31assertEq(f(0), 0);32assertEq(f(INT32_MIN), (2*INT32_MIN)|0);33assertEq(f(INT32_MAX), (2*INT32_MAX)|0);34var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return (2*i)|0 } return f"));35assertEq(f(0), 0);36assertEq(f(INT32_MIN), (2*INT32_MIN)|0);37assertEq(f(INT32_MAX), (2*INT32_MAX)|0);38var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return (i*1048575)|0 } return f"));39assertEq(f(0), 0);40assertEq(f(2), (1048575*2)|0);41assertEq(f(-1), (1048575*-1)|0);42assertEq(f(INT32_MIN), (1048575*INT32_MIN)|0);43assertEq(f(INT32_MAX), (1048575*INT32_MAX)|0);44var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return (1048575*i)|0 } return f"));45assertEq(f(0), 0);46assertEq(f(2), (1048575*2)|0);47assertEq(f(-1), (1048575*-1)|0);48assertEq(f(INT32_MIN), (1048575*INT32_MIN)|0);49assertEq(f(INT32_MAX), (1048575*INT32_MAX)|0);50var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; var j=0; j=~i; return j|0 } return f"));51assertEq(f(0), ~0);52assertEq(f(3), ~3);53assertEq(f(-3), ~-3);54assertEq(f(INT32_MAX), ~INT32_MAX);55assertEq(f(INT32_MIN), ~INT32_MIN);56assertEq(f(UINT32_MAX), ~UINT32_MAX);57var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=+i; var j=0; j=~~i; return j|0 } return f"));58assertEq(f(0), 0);59assertEq(f(3.5), 3);60assertEq(f(-3.5), -3);61assertEq(f(INT32_MAX), INT32_MAX);62assertEq(f(INT32_MIN), INT32_MIN);63assertEq(f(UINT32_MAX), -1);64var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; var j=0.0; j=+~~i; return +j } return f"));65assertEq(f(0), 0);66assertEq(f(INT32_MAX), INT32_MAX);67assertEq(f(INT32_MIN), INT32_MIN);68var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; var j=0.1; j=+(i>>>0); return +j } return f"));69assertEq(f(0), 0);70assertEq(f(INT32_MAX), INT32_MAX);71assertEq(f(UINT32_MAX), UINT32_MAX);72var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return (-i)|0 } return f"));73assertEq(f(0), 0);74assertEq(f(-0), 0);75assertEq(f(1), -1);76assertEq(f(INT32_MAX), INT32_MIN+1);77assertEq(f(INT32_MIN), INT32_MIN);78var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=+i; return +(-i) } return f"));79assertEq(f(0), -0);80assertEq(f(-0), 0);81assertEq(f(-1), 1);82assertEq(f(1), -1);83assertEq(f(Math.pow(2,50)), -Math.pow(2,50));84assertEq(f(1.54e20), -1.54e20);85var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; return ((i|0) < (j|0))|0 } return f"));86assertEq(f(0, 1), 1);87assertEq(f(1, 0), 0);88assertEq(f(1, 1), 0);89assertEq(f(INT32_MIN, INT32_MAX), 1);90assertEq(f(INT32_MAX, INT32_MIN), 0);91assertEq(f(0, INT32_MAX), 1);92assertEq(f(INT32_MAX, 0), 0);93assertEq(f(INT32_MIN, 0), 1);94assertEq(f(0, INT32_MIN), 0);95assertEq(f(UINT32_MAX, 0), 1);96assertEq(f(0, UINT32_MAX), 0);97var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; return ((i>>>0) < (j>>>0))|0 } return f"));98assertEq(f(0, 1), 1);99assertEq(f(1, 0), 0);100assertEq(f(1, 1), 0);101assertEq(f(INT32_MIN, INT32_MAX), 0);102assertEq(f(INT32_MAX, INT32_MIN), 1);103assertEq(f(0, INT32_MAX), 1);104assertEq(f(INT32_MAX, 0), 0);105assertEq(f(INT32_MIN, 0), 0);106assertEq(f(0, INT32_MIN), 1);107assertEq(f(UINT32_MAX, 0), 0);108assertEq(f(0, UINT32_MAX), 1);109var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k=0; k=(i|0)==(j|0); return k|0 } return f"));110assertEq(f(1,2), 0);111assertEq(f(1,1), 1);112assertEq(f(2,1), 0);113var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k=0; k=(i|0)!=(j|0); return k|0 } return f"));114assertEq(f(1,2), 1);115assertEq(f(1,1), 0);116assertEq(f(2,1), 1);117var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k=0; k=(i|0)<(j|0); return k|0 } return f"));118assertEq(f(1,2), 1);119assertEq(f(1,1), 0);120assertEq(f(1,0), 0);121var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k=0; k=(i|0)>(j|0); return k|0 } return f"));122assertEq(f(1,2), 0);123assertEq(f(1,1), 0);124assertEq(f(1,0), 1);125var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k=0; k=(i|0)<=(j|0); return k|0 } return f"));126assertEq(f(1,2), 1);127assertEq(f(1,1), 1);128assertEq(f(1,0), 0);129var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k=0; k=(i|0)>=(j|0); return k|0 } return f"));130assertEq(f(1,2), 0);131assertEq(f(1,1), 1);132assertEq(f(1,0), 1);133assertEq(asmLink(asmCompile(USE_ASM + "const I=2; function f(i) { i=i|0; var k=0; k=(i|0)<I; return k|0 } return f"))(1), 1);134assertEq(asmLink(asmCompile(USE_ASM + "const I=2; function f(i) { i=i|0; var k=0; k=(i>>>0)<I; return k|0 } return f"))(1), 1);135assertEq(asmLink(asmCompile(USE_ASM + "const I=-2; function f(i) { i=i|0; var k=0; k=(i|0)<I; return k|0 } return f"))(-1), 0);136assertAsmTypeFail(USE_ASM + "const I=-2; function f(i) { i=i|0; var k=0; k=(i>>>0)<I; return k|0 } return f");137assertAsmTypeFail(USE_ASM + "const I=0x80000000; function f(i) { i=i|0; var k=0; k=(i|0)<I; return k|0 } return f");138var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; return ((i|0)/(j|0))|0 } return f"));139assertEq(f(4,2), 2);140assertEq(f(3,2), 1);141assertEq(f(3,-2), -1);142assertEq(f(-3,-2), 1);143assertEq(f(0, -1), 0);144assertEq(f(0, INT32_MAX), 0);145assertEq(f(0, INT32_MIN), 0);146assertEq(f(INT32_MAX, 0), 0);147assertEq(f(INT32_MIN, 0), 0);148assertEq(f(-1, INT32_MAX), 0);149assertEq(f(-1, INT32_MIN), 0);150assertEq(f(INT32_MAX, -1), -INT32_MAX);151assertEq(f(INT32_MIN, -1), INT32_MIN); // !!152assertEq(f(INT32_MAX, INT32_MAX), 1);153assertEq(f(INT32_MAX, INT32_MIN), 0);154assertEq(f(INT32_MIN, INT32_MAX), -1);155assertEq(f(INT32_MIN, INT32_MIN), 1);156var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; return ((i>>>0)/(j>>>0))|0 } return f"));157assertEq(f(4,2), 2);158assertEq(f(3,2), 1);159assertEq(f(3,-2), 0);160assertEq(f(-3,-2), 0);161assertEq(f(0, -1), 0);162assertEq(f(0, INT32_MAX), 0);163assertEq(f(0, INT32_MIN), 0);164assertEq(f(0, UINT32_MAX), 0);165assertEq(f(INT32_MAX, 0), 0);166assertEq(f(INT32_MIN, 0), 0);167assertEq(f(UINT32_MAX, 0), 0);168assertEq(f(-1, INT32_MAX), 2);169assertEq(f(-1, INT32_MIN), 1);170assertEq(f(-1, UINT32_MAX), 1);171assertEq(f(INT32_MAX, -1), 0);172assertEq(f(INT32_MIN, -1), 0);173assertEq(f(UINT32_MAX, -1), 1);174assertEq(f(INT32_MAX, INT32_MAX), 1);175assertEq(f(INT32_MAX, INT32_MIN), 0);176assertEq(f(UINT32_MAX, INT32_MAX), 2);177assertEq(f(INT32_MAX, UINT32_MAX), 0);178assertEq(f(UINT32_MAX, UINT32_MAX), 1);179assertEq(f(INT32_MIN, INT32_MAX), 1);180assertEq(f(INT32_MIN, UINT32_MAX), 0);181assertEq(f(INT32_MIN, INT32_MIN), 1);182var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i|0)%(j|0)|0; return k|0 } return f"));183assertEq(f(4,2), 0);184assertEq(f(3,2), 1);185assertEq(f(3,-2), 1);186assertEq(f(-3,-2), -1);187assertEq(f(0, -1), 0);188assertEq(f(0, INT32_MAX), 0);189assertEq(f(0, INT32_MIN), 0);190assertEq(f(INT32_MAX, 0), 0);191assertEq(f(INT32_MIN, 0), 0);192assertEq(f(-1, INT32_MAX), -1);193assertEq(f(-1, INT32_MIN), -1);194assertEq(f(INT32_MAX, -1), 0);195assertEq(f(INT32_MIN, -1), 0); // !!196assertEq(f(INT32_MAX, INT32_MAX), 0);197assertEq(f(INT32_MAX, INT32_MIN), INT32_MAX);198assertEq(f(INT32_MIN, INT32_MAX), -1);199assertEq(f(INT32_MIN, INT32_MIN), 0);200var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i|0)%4|0; return k|0 } return f"));201assertEq(f(0), 0);202assertEq(f(-1), -1);203assertEq(f(-3), -3);204assertEq(f(-4), 0);205assertEq(f(INT32_MIN), 0);206assertEq(f(3), 3);207assertEq(f(4), 0);208assertEq(f(INT32_MAX), 3);209var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i>>>0)%(j>>>0)|0; return k|0 } return f"));210assertEq(f(4,2), 0);211assertEq(f(3,2), 1);212assertEq(f(3,-2), 3);213assertEq(f(-3,-2), -3);214assertEq(f(0, -1), 0);215assertEq(f(0, INT32_MAX), 0);216assertEq(f(0, INT32_MIN), 0);217assertEq(f(0, UINT32_MAX), 0);218assertEq(f(INT32_MAX, 0), 0);219assertEq(f(INT32_MIN, 0), 0);220assertEq(f(UINT32_MAX, 0), 0);221assertEq(f(-1, INT32_MAX), 1);222assertEq(f(-1, INT32_MIN), INT32_MAX);223assertEq(f(-1, UINT32_MAX), 0);224assertEq(f(INT32_MAX, -1), INT32_MAX);225assertEq(f(INT32_MIN, -1), INT32_MIN);226assertEq(f(UINT32_MAX, -1), 0);227assertEq(f(INT32_MAX, INT32_MAX), 0);228assertEq(f(INT32_MAX, INT32_MIN), INT32_MAX);229assertEq(f(UINT32_MAX, INT32_MAX), 1);230assertEq(f(INT32_MAX, UINT32_MAX), INT32_MAX);231assertEq(f(UINT32_MAX, UINT32_MAX), 0);232assertEq(f(INT32_MIN, INT32_MAX), 1);233assertEq(f(INT32_MIN, UINT32_MAX), INT32_MIN);234assertEq(f(INT32_MIN, INT32_MIN), 0);235assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (4 / 2)|0 } return f"))(), 2);236assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (3 / 2)|0 } return f"))(), 1);237assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (4 % 2)|0 } return f"))(), 0);238assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (3 % 2)|0 } return f"))(), 1);239assertAsmTypeFail(USE_ASM + "function f() { var i=42,j=1.1; return +(i?i:j) } return f");240assertEq(asmLink(asmCompile(USE_ASM + "function f() { return 0; 1 ? 1 : 1; return 0; } return f"))(), 0);241assertEq(asmLink(asmCompile(USE_ASM + "function f() { var i=42,j=1.1; return +(i?+(i|0):j) } return f"))(), 42);242assertEq(asmLink(asmCompile(USE_ASM + "function f() { var i=42,j=1; return (i?i:j)|0 } return f"))(), 42);243assertEq(asmLink(asmCompile(USE_ASM + "function f() { var i=42,j=1; return 13; return (i?i:j)|0 } return f"))(), 13);244assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (0 > (-(~~1) >>> 0)) | 0; } return f"))(), 0);245assertEq(asmLink(asmCompile(USE_ASM + "function f() { return 0 < 4294967294 | 0; } return f"))(), 1);246var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; return ((i|0)>(j|0)?(i+10)|0:(j+100)|0)|0 } return f"));247assertEq(f(2, 4), 104);248assertEq(f(-2, -4), 8);249var f = asmLink(asmCompile(USE_ASM + "function f(i,j,k) { i=i|0;j=j|0;k=k|0; return ((i|0)>(j|0) ? (i|0)>(k|0) ? i : k : (j|0)>(k|0) ? j : k)|0 } return f"));250assertEq(f(1,2,3), 3);251assertEq(f(1,3,2), 3);252assertEq(f(2,1,3), 3);253assertEq(f(2,3,1), 3);254assertEq(f(3,1,2), 3);255assertEq(f(3,2,1), 3);256var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var a=0,b=0; a=i>>>0 < 4294967292; b=(i|0) < -4; return (j ? a : b)|0 } return f"));257assertEq(f(1,true), 1);258assertEq(f(-1,true), 0);259assertEq(f(-5,true), 1);260assertEq(f(1,false), 0);261assertEq(f(-1,false), 0);262assertEq(f(-5,false), 1);263assertAsmTypeFail('glob','imp','b', USE_ASM + HEAP_IMPORTS + "function f() { return (i32[0]+1)|0 } return f");264new Float64Array(BUF_64KB)[0] = 2.3;265assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "function f() { return +(f64[0] + 2.0) } return f"), this, null, BUF_64KB)(), 2.3+2);266assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "function f() { return +(f64[0] - 2.0) } return f"), this, null, BUF_64KB)(), 2.3-2);267assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "function f() { return +(f64[0] * 2.0) } return f"), this, null, BUF_64KB)(), 2.3*2);268assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "function f() { return +(f64[0] / 2.0) } return f"), this, null, BUF_64KB)(), 2.3/2);269assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "function f() { return +(f64[0] % 2.0) } return f"), this, null, BUF_64KB)(), 2.3%2);270assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "function f() { return +-f64[0] } return f"), this, null, BUF_64KB)(), -2.3);271assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "var sqrt=glob.Math.sqrt; function f() { return +sqrt(f64[0]) } return f"), this, null, BUF_64KB)(), Math.sqrt(2.3));272new Int32Array(BUF_64KB)[0] = 42;273assertEq(asmLink(asmCompile('glob','imp','b', USE_ASM + HEAP_IMPORTS + "var imul=glob.Math.imul; function f() { return imul(i32[0], 2)|0 } return f"), this, null, BUF_64KB)(), 84);274// beware ye phis of comparisons and integers275var f = asmLink(asmCompile(USE_ASM + "function g(i) { i=i|0; if (i) { i = ((i|0) == 2); } else { i=(i-1)|0 } return i|0; } return g "));276assertEq(f(0), -1);277assertEq(f(1), 0);278assertEq(f(2), 1);279var f = asmLink(asmCompile(USE_ASM + "function g(i) { i=i|0; if (i) { i = !i } else { i=(i-1)|0 } return i|0; } return g "));280assertEq(f(0), -1);281assertEq(f(1), 0);282assertEq(f(2), 0);283// beware ye constant-evaluate of boolean-producing operators284assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (4 | (2 == 2))|0 } return f"))(), 5);285assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (4 | (!2))|0 } return f"))(), 4);286// get that order-of-operations right!287var buf = new ArrayBuffer(BUF_MIN);288asmLink(asmCompile('glob','imp','buf', USE_ASM + "var i32=new glob.Int32Array(buf); var x=0; function a() { return x|0 } function b() { x=42; return 0 } function f() { i32[((b()|0) & 0x3) >> 2] = a()|0 } return f"), this, null, buf)();289assertEq(new Int32Array(buf)[0], 42);290assertEq(asmLink(asmCompile(USE_ASM + "function f() { var a=0,i=0; for (; ~~i!=4; i=(i+1)|0) { a = (a*5)|0; if (+(a>>>0) != 0.0) return 1; } return 0; } return f"))(), 0)291// Signed integer division by a power of two.292var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return ((i|0)/1)|0; } return f;"));293for (let i = 0; i < 31; i++) {294 assertEq(f(Math.pow(2,i)), Math.pow(2,i));295 assertEq(f(Math.pow(2,i)-1), Math.pow(2,i)-1);296 assertEq(f(-Math.pow(2,i)), -Math.pow(2,i));297 assertEq(f(-Math.pow(2,i)-1), -Math.pow(2,i)-1);298}299assertEq(f(INT32_MIN), INT32_MIN);300assertEq(f(INT32_MAX), INT32_MAX);301var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return ((i|0)/2)|0; } return f;"));302for (let i = 0; i < 31; i++) {303 assertEq(f(Math.pow(2,i)), (Math.pow(2,i)/2)|0);304 assertEq(f(Math.pow(2,i)-1), ((Math.pow(2,i)-1)/2)|0);305 assertEq(f(-Math.pow(2,i)), (-Math.pow(2,i)/2)|0);306 assertEq(f(-Math.pow(2,i)-1), ((-Math.pow(2,i)-1)/2)|0);307}308assertEq(f(INT32_MIN), (INT32_MIN/2)|0);309assertEq(f(INT32_MAX), (INT32_MAX/2)|0);310var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return ((i|0)/4)|0; } return f;"));311for (let i = 0; i < 31; i++) {312 assertEq(f(Math.pow(2,i)), (Math.pow(2,i)/4)|0);313 assertEq(f(Math.pow(2,i)-1), ((Math.pow(2,i)-1)/4)|0);314 assertEq(f(-Math.pow(2,i)), (-Math.pow(2,i)/4)|0);315 assertEq(f(-Math.pow(2,i)-1), ((-Math.pow(2,i)-1)/4)|0);316}317assertEq(f(INT32_MIN), (INT32_MIN/4)|0);318assertEq(f(INT32_MAX), (INT32_MAX/4)|0);319var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return ((i|0)/1073741824)|0; } return f;"));320for (let i = 0; i < 31; i++) {321 assertEq(f(Math.pow(2,i)), (Math.pow(2,i)/Math.pow(2,30))|0);322 assertEq(f(Math.pow(2,i)-1), ((Math.pow(2,i)-1)/Math.pow(2,30))|0);323 assertEq(f(-Math.pow(2,i)), (-Math.pow(2,i)/Math.pow(2,30))|0);324 assertEq(f(-Math.pow(2,i)-1), ((-Math.pow(2,i)-1)/Math.pow(2,30))|0);325}326assertEq(f(INT32_MIN), (INT32_MIN/Math.pow(2,30))|0);327assertEq(f(INT32_MAX), (INT32_MAX/Math.pow(2,30))|0);328var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return ((((i|0)/1)|0)+i)|0; } return f;"));329for (let i = 0; i < 31; i++) {330 assertEq(f(Math.pow(2,i)), (Math.pow(2,i) * 2)|0);331 assertEq(f(Math.pow(2,i) - 1), ((Math.pow(2,i) - 1) * 2)|0);332 assertEq(f(-Math.pow(2,i)), (-Math.pow(2,i) * 2)|0);333 assertEq(f(-Math.pow(2,i) - 1), ((-Math.pow(2,i) - 1) * 2)|0);334}335assertEq(f(INT32_MIN), (INT32_MIN * 2)|0);336assertEq(f(INT32_MAX), (INT32_MAX * 2)|0);337// Signed integer division by a power of two - with a non-negative numerator!338var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; i=(i&2147483647)|0; return ((i|0)/1)|0; } return f;"));339for (let i = 0; i < 31; i++) {340 assertEq(f(Math.pow(2,i)), Math.pow(2,i));341 assertEq(f(Math.pow(2,i+1)-1), Math.pow(2,i+1)-1);342}343var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; i=(i&2147483647)|0; return ((i|0)/2)|0; } return f;"));344for (let i = 0; i < 31; i++) {345 assertEq(f(Math.pow(2,i)), (Math.pow(2,i)/2)|0);346 assertEq(f(Math.pow(2,i+1)-1), ((Math.pow(2,i+1)-1)/2)|0);347}348var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; i=(i&2147483647)|0; return ((i|0)/4)|0; } return f;"));349for (let i = 0; i < 31; i++) {350 assertEq(f(Math.pow(2,i)), (Math.pow(2,i)/4)|0);351 assertEq(f(Math.pow(2,i+1)-1), ((Math.pow(2,i+1)-1)/4)|0);352}353var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; i=(i&2147483647)|0; return ((i|0)/1073741824)|0; } return f;"));354for (let i = 0; i < 31; i++) {355 assertEq(f(Math.pow(2,i)), (Math.pow(2,i)/Math.pow(2,30))|0);356 assertEq(f(Math.pow(2,i+1)-1), ((Math.pow(2,i+1)-1)/Math.pow(2,30))|0);357}358var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; i=(i&2147483647)|0; return ((((i|0)/1)|0)+i)|0; } return f;"));359for (let i = 0; i < 31; i++) {360 assertEq(f(Math.pow(2,i)), (Math.pow(2,i) * 2)|0);361 assertEq(f(Math.pow(2,i+1) - 1), ((Math.pow(2,i+1) - 1) * 2)|0);362}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const INT32_MIN = -2147483648;2console.log(INT32_MIN);3const INT32_MAX = 2147483647;4console.log(INT32_MAX);5const INT64_MIN = -9223372036854775808;6console.log(INT64_MIN);7const INT64_MAX = 9223372036854775807;8console.log(INT64_MAX);9const UINT32_MAX = 4294967295;10console.log(UINT32_MAX);11const UINT64_MAX = 18446744073709551615;12console.log(UINT64_MAX);13console.log(isFinite(2));14console.log(isFinite(2.0));15console.log(isFinite(2.1));16console.log(isFinite(2.2));17console.log(isFinite(2.3));18console.log(isFinite(2.4));19console.log(isFinite(2.5));20console.log(isFinite(2.6));21console.log(isFinite(2.7));22console.log(isFinite(2.8));23console.log(isFinite(2.9));24console.log(isFinite(2.10));25console.log(isInteger(2));26console.log(isInteger(2.0));27console.log(isInteger(2.1));28console.log(isInteger(2.2));29console.log(isInteger(2.3));30console.log(isInteger(2.4));31console.log(isInteger(2.5));32console.log(isInteger(2.6));33console.log(isInteger(2.7));34console.log(isInteger(2.8));35console.log(isInteger(2.9));36console.log(isInteger(2.10));37console.log(isSafeInteger(2));38console.log(isSafeInteger(2.0));39console.log(isSafeInteger(2.1));40console.log(isSafeInteger(2.2));41console.log(isSafeInteger(2.3));42console.log(isSafeInteger(2.4));43console.log(isSafeInteger(2.5));44console.log(isSafeInteger(2.6));45console.log(is

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2console.log(wptoolkit.INT32_MIN);3var wptoolkit = require('wptoolkit');4console.log(wptoolkit.INT32_MAX);5var wptoolkit = require('wptoolkit');6console.log(wptoolkit.INT64_MIN);7var wptoolkit = require('wptoolkit');8console.log(wptoolkit.INT64_MAX);9var wptoolkit = require('wptoolkit');10console.log(wptoolkit.UINT32_MAX);11var wptoolkit = require('wptoolkit');12console.log(wptoolkit.UINT64_MAX);13var wptoolkit = require('wptoolkit');14console.log(wptoolkit.MAX_SAFE_INTEGER);15var wptoolkit = require('wptoolkit');16console.log(wptoolkit.MIN_SAFE_INTEGER);17var wptoolkit = require('wptoolkit');18console.log(wptoolkit.MAX_SAFE_INTEGER_32);19var wptoolkit = require('wptoolkit');20console.log(wptoolkit.MIN_SAFE_INTEGER_32);21var wptoolkit = require('wptoolkit');22console.log(wptoolkit.MAX_SAFE_INTEGER_64);

Full Screen

Using AI Code Generation

copy

Full Screen

1const {INT32_MIN} = require('wpt');2console.log(INT32_MIN);3const {INT32_MAX} = require('wpt');4console.log(INT32_MAX);5const {INT64_MIN} = require('wpt');6console.log(INT64_MIN);7const {INT64_MAX} = require('wpt');8console.log(INT64_MAX);9const {FLOAT_MIN} = require('wpt');10console.log(FLOAT_MIN);11const {FLOAT_MAX} = require('wpt');12console.log(FLOAT_MAX);13const {DOUBLE_MIN} = require('wpt');14console.log(DOUBLE_MIN);15const {DOUBLE_MAX} = require('wpt');16console.log(DOUBLE_MAX);17const {UINT32_MAX} = require('wpt');18console.log(UINT32_MAX);19const {UINT64_MAX} = require('wpt');20console.log(UINT64_MAX);21const {UINT8_MAX} = require('wpt');22console.log(UINT8_MAX);23const {UINT16_MAX} = require('wpt');24console.log(UINT16_MAX);25const {UINT8_MIN} = require('wpt');26console.log(UINT8_MIN);27const {UINT16_MIN} = require('wpt');28console.log(UINT16_MIN);29const {UINT32_MIN} = require('wpt');30console.log(UINT32_MIN);31const {UINT64_MIN} = require('wpt');32console.log(UINT64_MIN);33const {INT8_MIN} = require('wpt');34console.log(INT8_MIN);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4 if (err) {5 console.log(err);6 }7 console.log(data);8});9var wpt = require('webpagetest');10var options = {11};12 if (err) {13 console.log(err);14 }15 console.log(data);16});17var wpt = require('webpagetest');18var options = {19};20 if (err) {21 console.log(err);22 }23 console.log(data);24});25var wpt = require('webpagetest');26var options = {27};

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful