From owner-svn-src-head@FreeBSD.ORG Fri Mar 30 10:25:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 26494106564A; Fri, 30 Mar 2012 10:25:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 6A3228FC1E; Fri, 30 Mar 2012 10:25:40 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q2UAPc3T018733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Mar 2012 21:25:39 +1100 Date: Fri, 30 Mar 2012 21:25:38 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric In-Reply-To: <201203292330.q2TNUHbu014843@svn.freebsd.org> Message-ID: <20120330211008.K1071@besplex.bde.org> References: <201203292330.q2TNUHbu014843@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r233683 - head/sys/x86/include 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: Fri, 30 Mar 2012 10:25:42 -0000 On Thu, 29 Mar 2012, Dimitry Andric wrote: > Log: > Revert sys/x86/include/endian.h to what it was before r233419, as that > revision has two problems: > - It can produce worse code with both clang and gcc. > - It doesn't fix the actual issue introduced in r232721, which will be > fixed in the next commit. > > Submitted by: bde, tijl and jh > Pointy hat to: dim Thanks. I didn't know that there was an actualy bug to be fixed... > Modified: > head/sys/x86/include/endian.h > > Modified: head/sys/x86/include/endian.h > ============================================================================== > --- head/sys/x86/include/endian.h Thu Mar 29 21:54:19 2012 (r233682) > +++ head/sys/x86/include/endian.h Thu Mar 29 23:30:17 2012 (r233683) > @@ -63,11 +63,11 @@ > #define BYTE_ORDER _BYTE_ORDER > #endif > > -#define __bswap16_gen(x) ((__uint16_t)((x) << 8 | (x) >> 8)) > +#define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8) > #define __bswap32_gen(x) \ > - (((__uint32_t)__bswap16_gen(x) << 16) | __bswap16_gen((x) >> 16)) > + (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16)) > #define __bswap64_gen(x) \ > - (((__uint64_t)__bswap32_gen(x) << 32) | __bswap32_gen((x) >> 32)) > + (((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32)) > > #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P > #define __bswap16(x) \ > ... it seems that there was no bug. After looking at the next commit, the bug backed out here is now clear, and I don't like the next commit either (more details on that in a reply to it). Using the non-generic versions ensured that there were no extra bits. In the `const' case, this is implemented using casts. But the generic versions don't have these casts. Bruce