S
Srinivas Mudireddy
Hi,
I am running in to a problem and let me paraphrase it with a fake use
case.
Say, I have a macro like
#define MIN(x, y) ((x) < (y) ? (x) : (y))
Now how do I still return a value from this macro if I want to add
some debug messages? For example, I want to rewrite above macro as
#define MIN(x, y) \
{ \
if ((x) < (y)) \
{ \
printf("MIN is first arg"); \
} \
else \
{ \
printf("MIN is second arg"); \
} \
//Need something here which would return min value \
}
I could implement this macro as an inline function but we have ~15
such macros in the data path which get executed for each packet. We
are worried that performance will be impacted if compiler doesn't
actually make the functions inline.
Please let me know if there is a way to solve this problem.
Thx,
Sri
I am running in to a problem and let me paraphrase it with a fake use
case.
Say, I have a macro like
#define MIN(x, y) ((x) < (y) ? (x) : (y))
Now how do I still return a value from this macro if I want to add
some debug messages? For example, I want to rewrite above macro as
#define MIN(x, y) \
{ \
if ((x) < (y)) \
{ \
printf("MIN is first arg"); \
} \
else \
{ \
printf("MIN is second arg"); \
} \
//Need something here which would return min value \
}
I could implement this macro as an inline function but we have ~15
such macros in the data path which get executed for each packet. We
are worried that performance will be impacted if compiler doesn't
actually make the functions inline.
Please let me know if there is a way to solve this problem.
Thx,
Sri