On Jun 30, 2010, at 12:17 PM, Bruce Evans wrote:
>> I like this. What about the following (white-space corrupted)
>> simplification:
> 
> Almost OK.  I orginally wrote it with a conditional operator, but decided
> that that might be harder to understand.
> 
>> Index: gmon.c
>> ===================================================================
>> --- gmon.c   (revision 209604)
>> +++ gmon.c   (working copy)
>> @@ -110,24 +110,9 @@
>>      p->tos[0].link = 0;
>> 
>>      o = p->highpc - p->lowpc;
>> -    if (p->kcountsize < o) {
>> -#if !defined(__powerpc__)
>> -            s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1;
>> -#else /* avoid floating point */
>> -            int quot = o / p->kcountsize;
>> +    s_scale = (p->kcountsize < o) ?
>> +        ((uintmax_t)p->kcountsize << SCALE_1_TO_1) / o : SCALE_1_TO_1;
> 
> Shifting by 65536 is a bit much :-).  Multiplication by 65536 might
> give the same code as shifting by 16, but I think shifting is clearer.

Doh... :-)

Ok. I'll remove SCALE_1_TO_1 and instead define SCALE_SHIFT.
Substitutions in expressions as expected.

Thanks,

-- 
Marcel Moolenaar
xcl...@mac.com



_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to