• Sun 2018.08.26

    As it appears that basic math trig functions are not available using inline C either,

    ref: 'Syntax for pow function using inline C'

    http://forum.espruino.com/comments/14387611/

    I am attempting to build SOH CAH TOA in static lookup tables. With the limitations on array handling

    'Use Array/TypedArray.forEach to call your function'

    http://www.espruino.com/InlineC

    I wondering if hard coding each value using a smart name for lookup might be possible. Estimating around 320 unique definitions. Might this be possible without choking the inline C compiler?

    Is there an online reference regarding compiler limitations?

  • I'm not quite sure what you intend? You want to just define an array? If so, you just define that array in your Inline C code:

    var c = E.compiledC(`
    // double lookup(int)
    
    double lut[8] = {
     1,2,3,4,5,6,7,8
    };
    double lookup(unsigned int x)
    {
      return lut[x&7]; 
    }
    `);
    

    I don't believe there are limitations on the number of items you can have in Inline C, but each one uses a JsVar to store a reference to the function, so you'll quickly use up your device's memory.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

What is the maximum number of definitions allowed assigned to one inline C var

Posted by Avatar for Robin @Robin

Actions