I want to make a lookup-table/array.
The index values I get are of the form k = 2^n only, where n is an integer. So I want to reduce the arrays size to n and I therefore have to perform an operation on the index values as well.
I want the most efficient way to do this as I am programming on an embedded platform.
Example:
I got the values n = {1, 2, 4, 8, 16, 32}
I have an array defined as:
int myArray[6];
Now I want to convert the values n to m, where m = {1, 2, 3, 4, 5, 6} so I can access array elements:
myArray[m];