>>> On 17.09.15 at 17:19, <andrew.coop...@citrix.com> wrote:
> On 14/09/15 03:32, Wei Wang wrote:
>> --- a/xen/include/xen/kernel.h
>> +++ b/xen/include/xen/kernel.h
>> @@ -43,6 +43,29 @@
>>  #define MAX(x,y) ((x) > (y) ? (x) : (y))
>>  
>>  /**
>> + * clamp - return a value clamped to a given range with strict typechecking
>> + * @val: current value
>> + * @lo: lowest allowable value
>> + * @hi: highest allowable value
>> + *
>> + * This macro does strict typechecking of lo/hi to make sure they are of the
>> + * same type as val.  See the unnecessary pointer comparisons.
>> + */
>> +#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
> 
> This is a change of behaviour from the clamp() you removed, as this now
> evaluates its arguments multiple times.
> 
> Please use a ({ }) style macro to avoid evaluating the arguments
> multiple times.

So where do you see the multiple argument evaluation? The only
odd thing I can spot is the type cast on the result of max(), which
ought to be superfluous (due to the strict type handling of both
max() and min()).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to