M
MBALOVER
Hi all,
Actually I want my code to be
for (i=0;i<N;i++)
{
array2[i*30]=array1;
array2[i*30+1]=array1;
array2[i*30+2]=array1;
array2[i*30+3]=array1;
..................
..................
..................
array2[i*30+28]=array1;
array2[i*30+29]=array1;
}
If there anyway to use macros to do it instead for listing out
manually in the code like above?
(the listing out such as the above example will be very bad in the
case I need, say, array2[i*1000+0]=array1; to ...
array2[i*1000+999]=array1
And please note that for some reasons of my device, I do not want to
use another loop such as
for (i=0;i<N;i++)
for (j=0;j<30;j++)
array2[i*30+j]=array1;
If I write a macro as follows:
#define myMacro (array1, array2) \
for ( j=0;j<30;j++) \
array2[i*30+j]=array1; \
Does it help? I doubt it because it will be the same as the case with
two loops that I want to avoid.
Thanks a lot.
Actually I want my code to be
for (i=0;i<N;i++)
{
array2[i*30]=array1;
array2[i*30+1]=array1;
array2[i*30+2]=array1;
array2[i*30+3]=array1;
..................
..................
..................
array2[i*30+28]=array1;
array2[i*30+29]=array1;
}
If there anyway to use macros to do it instead for listing out
manually in the code like above?
(the listing out such as the above example will be very bad in the
case I need, say, array2[i*1000+0]=array1; to ...
array2[i*1000+999]=array1
And please note that for some reasons of my device, I do not want to
use another loop such as
for (i=0;i<N;i++)
for (j=0;j<30;j++)
array2[i*30+j]=array1;
If I write a macro as follows:
#define myMacro (array1, array2) \
for ( j=0;j<30;j++) \
array2[i*30+j]=array1; \
Does it help? I doubt it because it will be the same as the case with
two loops that I want to avoid.
Thanks a lot.