RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/tools/ dbconvert.c

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 10 Apr 2011 - 14:34:51 CEST
Message-id: <63D3C3D8-7F93-479E-A39A-6188EB86ADA4@mac.com>
Actually GCC is in use almost everywhere, so portability isn't *too*
bad a problem.

But __builtin_expect is just fetishism: there's nothing in dbconvert.c that
is perfromance critical where __builtin_expect might be justified.

73 de Jeff

On Apr 10, 2011, at 6:16 AM, Per Řyvind Karlsen wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/
>  ____________________________________________________________________________
> 
>  Server: rpm5.org                         Name:   Per Řyvind Karlsen
>  Root:   /v/rpm/cvs                       Email:  pkarlsen@rpm5.org
>  Module: rpm                              Date:   10-Apr-2011 12:16:29
>  Branch: HEAD                             Handle: 2011041010162900
> 
>  Modified files:
>    rpm/tools               dbconvert.c
> 
>  Log:
>    drop __builtin_expect micro optimization which most likely the only
>    considerable effect of being breaking compatibility
> 
>  Summary:
>    Revision    Changes     Path
>    2.3         +2  -2      rpm/tools/dbconvert.c
>  ____________________________________________________________________________
> 
>  patch -p0 <<'@@ .'
>  Index: rpm/tools/dbconvert.c
>  ============================================================================
>  $ cvs diff -u -r2.2 -r2.3 dbconvert.c
>  --- rpm/tools/dbconvert.c	30 Mar 2011 14:16:03 -0000	2.2
>  +++ rpm/tools/dbconvert.c	10 Apr 2011 10:16:29 -0000	2.3
>  @@ -172,14 +172,14 @@
>   	      fflush(stdout);
>   	      if(i == 1 && !*(uint32_t*)key.data)
>   		    continue;
>  -	      if(__builtin_expect(doswap, 1) < 0) {
>  +	      if(doswap < 0) {
>   		if((htole32(*(uint32_t*)key.data) > 10000000 && swap < 0) ||
>   		    (htole32(*(uint32_t*)key.data) < 10000000 && swap > 0))
>   		  doswap = 1;
>   		else
>   		  doswap = 0;
>   	      }
>  -	      if(__builtin_expect(doswap, 1)) {
>  +	      if(doswap) {
>   		if(swap)
>   		  *(uint32_t*)key.data = bswap32(*(uint32_t*)key.data);
>   	      }
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org



  • application/pkcs7-signature attachment: smime.p7s
Received on Sun Apr 10 14:35:24 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.