|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 1/9] x86/intel_pstate: add some calculation related support
>>> On 17.09.15 at 17:19, <andrew.cooper3@xxxxxxxxxx> 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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |