Messages in this thread | | | Date | Wed, 03 Oct 2012 14:54:27 +0200 | From | Avi Kivity <> | Subject | Re: [PATCH 06/31] perf, kvm: Support the intx/intx_cp modifiers in KVM arch perfmon emulation |
| |
On 10/03/2012 02:11 PM, Andi Kleen wrote: >> > - eventsel & ARCH_PERFMON_EVENTSEL_INT); >> > + eventsel & ARCH_PERFMON_EVENTSEL_INT, >> > + !!(eventsel & HSW_INTX), >> > + !!(eventsel & HSW_INTX_CHECKPOINTED)); >> > } >> > >> >> Those !! are !necessary, since the formal argument is a bool. > > bool is 1 or 0, x & y with y > 1 is not 1 or 0. > iirc assigning > 1 to bool is undefined > > So I think they are necessary.
Conversion to bool coerces the value to 0 or 1.
_Bool ret(int x) { return x & 0x10000; } 20: 81 e7 00 00 01 00 and $0x10000,%edi 26: 0f 95 c0 setne %al 29: c3 retq
-- error compiling committee.c: too many arguments to function
| |