• Sat 2018.10.06

    Not strong enough with Espruino debugger to solve this, as my pointer offsets appear to be the culprits

    Trying to convert this working code block to inlineC

    for( var i=0; i<this.ac.length; i++ ) {
        var nRGBCur = this.af[i];
        this.ac[i] = this.ag[nRGBCur];
    }
    

    Leaving out the overhead ex:

    var addrdest = E.getAddressOf(dest,true);
    

    Have tried

    for( int i=0; i<size; i++ ) {
      int nRGBCur = *(datasrc[i]);
      *(datadest++) = *(datag[nRGBCur]);
    }
    

    and

    int nRGBCur = *(datasrc+i);
    *(datadest++) = *(datag+nRGBCur);
    

    but both corrupt memory as can be seen by viewing 'this' and instantiated variable contents in IDE console.

    My belief is the arrangement of the JSVars in memory, thus the offsets are off. e.g. what the pointers point to

    ref: http://forum.espruino.com/comments/14431­325/

    I am able to walk the array one element at a time in succession (not what I'm after)

    for( int i=0; i<size; i++ ) {
      *(datadest++) = *(datasrc++);
    }
    

    I understand the pointer points to the address and the address value is incremented to the next higher address.
    What I need is the pointer points to the address and the address is incremented to an offset into that array at that address.

    Any insight greatly appreciated.

About

Avatar for Robin @Robin started