R
R.Biloti
Hi
I defined two usual macros for max and min:
#define max(x,y) ( (x) > (y) ? (x) : (y) )#define min(x,y) ( (x) <
(y) ? (x) : (y) )
I need to compute max( x1, min( x2, x3) ).
Is it efficient to perform such operation in that way? I mean, this
macro is firstly expanded as
( (x1) > (min(x2,x3)) ? (x1) : (min(x2,x3)) )
and so the comparison in min(x2,x3) could be done twice. Should I
define an auxiliar variable to store min(x2,x3) and then call
max(x1,aux)? Is there a way to fix the macros so that the user
shouldn't care about?
Thanks
R. Biloti
I defined two usual macros for max and min:
#define max(x,y) ( (x) > (y) ? (x) : (y) )#define min(x,y) ( (x) <
(y) ? (x) : (y) )
I need to compute max( x1, min( x2, x3) ).
Is it efficient to perform such operation in that way? I mean, this
macro is firstly expanded as
( (x1) > (min(x2,x3)) ? (x1) : (min(x2,x3)) )
and so the comparison in min(x2,x3) could be done twice. Should I
define an auxiliar variable to store min(x2,x3) and then call
max(x1,aux)? Is there a way to fix the macros so that the user
shouldn't care about?
Thanks
R. Biloti