[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 01/16] xen: Add support for VMware cpuid leaves
On 09/15/14 03:42, Jan Beulich wrote: On 12.09.14 at 19:46, <dslutz@xxxxxxxxxxx> wrote:On 09/12/14 05:49, Jan Beulich wrote:On 11.09.14 at 21:49, <andrew.cooper3@xxxxxxxxxx> wrote:+ case 0x10: + /* (Virtual) TSC frequency in kHz. */ + *eax = d->arch.tsc_khz; + /* (Virtual) Bus (local apic timer) frequency in kHz. */ + *ebx = 1000000000ull / APIC_BUS_CYCLE_NS / 1000ull;At least 1 pair of brackets please, especially as the placement of brackets affects the result of this particular calculation.Or simply eliminate one of the divisions using "1000000ull / APIC_BUS_CYCLE_NS".I am totally confused. I am happy to go with Jan's version. The confusion is that I get the same answer all the ways I try.Hmm - this ...ebx1 = 1000000000ull / APIC_BUS_CYCLE_NS / 1000ull; ebx2 = (1000000000ull / APIC_BUS_CYCLE_NS) / 1000ull; ebx3 = 1000000000ull / (APIC_BUS_CYCLE_NS * 1000ull);... clearly indicates the contrary: You converted to mutiplication here, when the respective possibility of putting parentheses here would have been ebx3 = 1000000000ull / (APIC_BUS_CYCLE_NS / 1000ull); which I'm sure you agree won't produce the same result. But yes, the language implies parentheses this way Yes, I agree. Since that is not mathematical correct either. This has the same issue as "a - b -c" is the same as "(a - b) - c" but not "a - (b - c)". However the "order" can be changed. "a / b / c" and "a / c / b" is the same. ebx2 = (1000000000ull / APIC_BUS_CYCLE_NS) / 1000ull; so the original expression without them was correct, just slightly ambiguous. Ok, I see that preventing mistakes here can only help. -Don Slutz Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |