Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2010 12:34:24 -0700
From:      Marcel Moolenaar <xcllnt@mac.com>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar <marcel@FreeBSD.org>, src-committers@FreeBSD.org
Subject:   Re: svn commit: r209604 - head/lib/libc/gmon
Message-ID:  <E659CDD2-D1A4-44AB-9D9C-59F6E05664FC@mac.com>
In-Reply-To: <20100701050124.J4356@besplex.bde.org>
References:  <201006300140.o5U1eQVG097566@svn.freebsd.org> <20100630184517.B51465@delplex.bde.org> <79DD181D-3885-45F5-9E9D-753553D19891@mac.com> <20100701050124.J4356@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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
xcllnt@mac.com






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E659CDD2-D1A4-44AB-9D9C-59F6E05664FC>