--- Quote Start ---
Then change the code this way:
alt_u8 small_1= {1,2,3,4};
alt_u8 small_2= {5,6,7,8};
alt_u32 custom_int_res = 0;
custom_int_res = ALT_CI_MYMACRO( *((alt_u32 *)small_1), *((alt_u32 *)small_2) );
--- Quote End ---
Thank you so much again Cris and with the very good explanation too. I tried your method and this operation happened with less ticks than when using the '<<'.
Now I have another problem :) Those small_1 and small_2 arrays have changing values, coming from a bigger array. The 8 values are being collected from as a 'sliding window' as shown in code below.
# define ROW 3# define COL 5
// 2-D array containing unsigned 8-bit integers
alt_u8 array_image = { /* fill in values */};
alt_u8 small_1;
alt_u8 small_2;
for(y=0; y<(ROW -2); y++) {
for(x=0; x<(COL-2); x++) {
small_1 = array_image; small_1 = array_image;
small_1 = array_image; small_1 = array_image;
small_2 = array_image; small_2 = array_image;
small_2 = array_image; small_2 = array_image;
store_result = ALT_CI_MYMACRO( *((alt_u32 *)small_1), *((alt_u32 *)small_2) );
}
}
But the fact that I am populating the small arrays within the loops requires nios cpu time. Is there instead a smart way again using the pointers to do this? For example, suppose my 3x5 data is as such:
10 20 30 40 50
11 21 31 41 51
12 22 32 42 52
I want the following values in each small array at each loop iteration.
at x = 0, small_1 = {10,20,30,11} and small_2 = {31,12,22,32}
at x = 1, small_1 = {20,30,40,21} and small_2 = {41,22,32,42}
at x = 2, small_1 = {30,40,50,31} and small_2 = {51,32,42,52}