You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Just to add that in 1v61 you'll be able to use Array.reduce too - which will be extremely useful if you want to do some analysis on an ArrayBuffer with inline assembler.

    For instance maybe you want to sum up all the values in an ArrayBuffer...

    // effectively function (a,b) { return a+b; }
    var adder = E.asm("int(int,int)", 
    "adds    r0, r0, r1",
    "bx  lr");
    
    
    // fill up array buffer
    var a = new Int16Array(100);
    for (var i in a) a[i]=i;
    
    // Call our assembler on every item
    var sum = [].reduce.call(a, adder);
    
    console.log(sum); // 4950 
    
About

Avatar for Gordon @Gordon started