[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] x86: reduce redundancy in tsc_[gs]et_info()



>>> On 06.05.14 at 15:49, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 06/05/14 14:29, Jan Beulich wrote:
>>      case TSC_MODE_PVRDTSCP:
>> -        d->arch.vtsc =  boot_cpu_has(X86_FEATURE_RDTSCP) &&
>> -                        host_tsc_is_safe() ?  0 : 1;
>> +        d->arch.vtsc = boot_cpu_has(X86_FEATURE_RDTSCP) &&
>> +                       host_tsc_is_safe() ?  0 : 1;
> 
> Can this be reduced to boot_cpu_has(X86_FEATURE_RDTSCP) &&
> !host_tsc_is_safe() ?
> 
> I believe this is the correct way around with the precedence between &&
> and ?!, but it is far from clear.  Alternatively, could some brackets be
> introduced for clarity?

No, ?: has lower precedence than all binary operators other than
assignment ones and comma. But yes, this is ugly - I'll change it to

d->arch.vtsc = !(boot_cpu_has(X86_FEATURE_RDTSCP) && host_tsc_is_safe());

or, one character shorter,

d->arch.vtsc = !boot_cpu_has(X86_FEATURE_RDTSCP) || !host_tsc_is_safe();

(somehow I also managed to overlook the other double space in there).

Jan


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.