N
Nudge
I have an array, and an unrolled loop which looks like this:
do_something(A[0]);
do_something(A[1]);
....
do_something(A[255]);
I thought: why should I type so much? I should write a macro.
So I was looking to write something along the lines of:
#define write_256(array) #for(i,0,255,do_something(foo);
But I coudn't find a way to do it...
Is there a way to write a macro that the C pre-processor will expand
to k instructions, and be able to reference the iteration number?
I thought of using recursive macro calls along the lines of:
#define write_more(n,array) \
#if (n>0) do_something(foo[256-n]); \
write_more(n-1,array)
but it seems implementers don't like recursive macro calls
Any insight?
do_something(A[0]);
do_something(A[1]);
....
do_something(A[255]);
I thought: why should I type so much? I should write a macro.
So I was looking to write something along the lines of:
#define write_256(array) #for(i,0,255,do_something(foo);
But I coudn't find a way to do it...
Is there a way to write a macro that the C pre-processor will expand
to k instructions, and be able to reference the iteration number?
I thought of using recursive macro calls along the lines of:
#define write_more(n,array) \
#if (n>0) do_something(foo[256-n]); \
write_more(n-1,array)
but it seems implementers don't like recursive macro calls
Any insight?