Hi,
- I am in doubt whether or not the following C code will do as it is intended. For example, does it - as expected - take a whole array (called vector) as input, or is there something very basic in the syntax which makes that not possible as it is now?
- As i've worked in matlab for years, i have forgotten a lot of the fine details in C - like addresses and pointers. I expect the LUT_BASE define is alright - but will *(LUT_BASE+k) take the value at address (LUT_BASE+k) ?
For example, if k is 2, and the memory at address location 0x001002 contains the integer 43 - would *(LUT_BASE+2) then return 43?
- I'm also a little bit confused about the addresses to increment to get the next number in the look-up table. Each number in the look-up-table is stored as signed integers (16 bit) - but wouldn't that mean that i have to increase the addresses for each iteration by 5 (2^4=16, and increment 1 to the next address to find the start)?
Thanks for any hints.
Code:#include <stdio.h> #define BLOCK_SIZE 2048 #define LUT_BASE ( char *) 0x001000f void main(int **permute, int *array) { int k; int permute[BLOCK_SIZE]; for(k=0; k<=BLOCK_SIZE-1; k++) { permute[k]=array[*(LUT_BASE+k)]; } return; }