Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/asm.js/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  bug941877.js

  Sprache: JAVA
 

load(libdir + "asm.js");

function FunctionBody(f) {
    var str = f.toString();
    var firstBrace = str.indexOf('{');
    var lastBrace = str.lastIndexOf('}');
    return str.substr(firstBrace + 1, lastBrace - firstBrace - 1);
}

var F = (function (stdlib, n, heap) {
    var Int16ArrayView = new stdlib.Int16Array(heap);
    function f(i0, d1) {
        i0 = i0 | 0
        d1 = +d1
        var d2 = 1.
        var i3 = 0
        Int16ArrayView[0] = i0
        d2 = (.0 / .0)
        switch ((i0 + i0) | 0) {
            case 0:
                d2 = .0
                break
        };
        (((i3 - (0 < 0)) >>> ((.0 < -0) + (.0 > .0))) / 0) >> (0 + (((0 + 0) ^
(9 > 0)) | 0))
    }
    return f;
});

var compiled = asmCompile('stdlib''n''heap', USE_ASM + FunctionBody(F));
asmLink(compiled, thisnullnew ArrayBuffer(BUF_MIN))();

var F = (function(stdlib, n, heap) {
    var Float64ArrayView = new stdlib.Float64Array(heap)
    function f() {
        Float64ArrayView[0] = +(0xffffffff / 0xffffffff >> 0)
    }
    return f;
});

var compiled = asmCompile('stdlib''n''heap', USE_ASM + FunctionBody(F));
asmLink(compiled, thisnullnew ArrayBuffer(BUF_MIN))();

function test0(x)
{
   return (x >>> 0) % 10;
}
assertEq(test0(25), 5);
assertEq(test0(24), 4);
assertEq(test0(23), 3);
assertEq(test0(0), 0);
assertEq(test0(4294967295), 5);

function test1(x)
{
   return (x >>> 2) % 10;
}
assertEq(test1(25), 6);
assertEq(test1(24), 6);
assertEq(test1(23), 5);
assertEq(test1(4294967295), 3);

function test2(x, y)
{
   return (x >>> 0) % (y >>> 0);
}
assertEq(test2(253), 1);
assertEq(test2(244), 0);
assertEq(test2(429496729510), 5);
assertEq(test2(230), NaN);

function test3()
{
    function f(x, y)
    {
        x = x|0;
        y = y|0;
        var t = 0;
        t = (((x|0) % (y|0))|0) > -2;
        return t|0;
    }
    return f;
}
var compiled = asmCompile(USE_ASM + FunctionBody(test3));
var linked = asmLink(compiled);
assertEq(linked(42949672904294967295), 1);
assertEq(linked(42949672904294967295), 1);

function test4()
{
    function f(x, y)
    {
        x = x|0;
        y = y|0;
        var t = 0;
        t = (((x>>>0) % (y>>>0)) >>> 0) > 0;
        return t|0;
    }
    return f;
}
var compiled = asmCompile(USE_ASM + FunctionBody(test4));
var linked = asmLink(compiled);
assertEq(linked(42949672904294967295), 1);
assertEq(linked(42949672904294967295), 1);

function test5()
{
    function f(x, y)
    {
        x = x|0;
        y = y|0;
        var t = 0.;
        t = +(((x>>>0) % (y>>>0)) >>> 0) * 1.01;
        return +t;
    }
    return f;
}
var compiled = asmCompile(USE_ASM + FunctionBody(test5));
var linked = asmLink(compiled);
assertEq(linked(42949672904294967295), 4337916962.9);
assertEq(linked(42949672904294967295), 4337916962.9);

function test6()
{
    function f(x, y)
    {
        x = x|0;
        y = y|0;
        return ((x>>>1) % (y>>>1))|0;
    }
    return f;
}
var compiled = asmCompile(USE_ASM + FunctionBody(test6));
var linked = asmLink(compiled);
assertEq(linked(238477), 1);
assertEq(linked(238487), 2);

function test7()
{
    function f(x)
    {
        x = x|0;
        return ((x>>>0) / 8)|0;
    }
    return f;
}
var compiled = asmCompile(USE_ASM + FunctionBody(test7));
var linked = asmLink(compiled);
assertEq(linked(238477), 2980);
assertEq(linked(238487), 2981);

function test8()
{
    function f(i,j)
    {
        i=i|0;j=j|0;
        return ((i>>>0)/(j>>>0))|0;
    }
    return f;
}
var compiled = asmCompile(USE_ASM + FunctionBody(test8));
var linked = asmLink(compiled);
assertEq(linked(21474836470), 0);
assertEq(linked(21474836460), 0);

Messung V0.5 in Prozent
C=98 H=86 G=91

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.