From owner-svn-src-head@FreeBSD.ORG Wed Jun 30 19:34:26 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91EB9106564A; Wed, 30 Jun 2010 19:34:26 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout024.mac.com (asmtpout024.mac.com [17.148.16.99]) by mx1.freebsd.org (Postfix) with ESMTP id 7456A8FC14; Wed, 30 Jun 2010 19:34:26 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from [172.24.241.135] (natint3.juniper.net [66.129.224.36]) by asmtp024.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0L4U00904EDCEB20@asmtp024.mac.com>; Wed, 30 Jun 2010 12:34:26 -0700 (PDT) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1004200000 definitions=main-1006300112 X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5,1.2.40,4.0.166 definitions=2010-06-29_03:2010-02-06, 2010-06-29, 2010-06-30 signatures=0 From: Marcel Moolenaar In-reply-to: <20100701050124.J4356@besplex.bde.org> Date: Wed, 30 Jun 2010 12:34:24 -0700 Message-id: References: <201006300140.o5U1eQVG097566@svn.freebsd.org> <20100630184517.B51465@delplex.bde.org> <79DD181D-3885-45F5-9E9D-753553D19891@mac.com> <20100701050124.J4356@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar , src-committers@FreeBSD.org Subject: Re: svn commit: r209604 - head/lib/libc/gmon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 19:34:26 -0000 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