This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to create Lookup table ?

how to create lookup table ?

Parents
  • A lookup table is just an array of constant data. You might pre-calculate data and use a static initializer, or perhaps you just allocate some RAM and execute an algorithm at init time to fill the array.

    Here's an lame example that uses a lookup table to calculate the square roots of integers:

    U16 sqrt[4] = { 0, 1000, 1414, 1732 };

    U16 lameSqrt (U16 n)
    {
    return sqrt[n];
    }

Reply
  • A lookup table is just an array of constant data. You might pre-calculate data and use a static initializer, or perhaps you just allocate some RAM and execute an algorithm at init time to fill the array.

    Here's an lame example that uses a lookup table to calculate the square roots of integers:

    U16 sqrt[4] = { 0, 1000, 1414, 1732 };

    U16 lameSqrt (U16 n)
    {
    return sqrt[n];
    }

Children
No data