I often find myself writing something like
int computedValue = ...;
return MAX(0, MIN(5, computedValue));
I would like to be able to write this as a single one-line macro. It must be free of side effects, in the same way that the existing system macros MIN and MAX are, and should work for the same data types as MIN and MAX.
Can anyone show me how to turn this into a single macro?