From owner-svn-src-head@FreeBSD.ORG Tue Mar 20 12:34:14 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 CBC50106566C; Tue, 20 Mar 2012 12:34:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7258FC0A; Tue, 20 Mar 2012 12:34:14 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 3B28346B0C; Tue, 20 Mar 2012 08:34:14 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 49D20B93E; Tue, 20 Mar 2012 08:34:13 -0400 (EDT) From: John Baldwin To: Tijl Coosemans Date: Tue, 20 Mar 2012 08:34:10 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201203091148.q29BmuIp005151@svn.freebsd.org> In-Reply-To: <201203091148.q29BmuIp005151@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201203200834.10539.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 20 Mar 2012 08:34:13 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232721 - 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: Tue, 20 Mar 2012 12:34:14 -0000 On Friday, March 09, 2012 6:48:56 am Tijl Coosemans wrote: > Author: tijl > Date: Fri Mar 9 11:48:56 2012 > New Revision: 232721 > URL: http://svn.freebsd.org/changeset/base/232721 > > Log: > Clean up x86 endian.h: > - Remove extern "C". There are no functions with external linkage here. [1] > - Rename bswapNN_const(x) to bswapNN_gen(x) to indicate that these macros > are generic implementations that can take non-constant arguments. [1] > - Split up __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P and deal with > each separately. > - Replace _LP64 with __amd64__ because asm instructions are machine > dependent, not ABI dependent. > > Submitted by: bde [1] > Reviewed by: bde BTW, I think I found an old "bug" in this file. The _gen() variants should only use the _gen() variants of smaller types rather than using the version that re-checks __build_constant_p() I think. That is: Index: x86/include/endian.h =================================================================== --- endian.h (revision 233184) +++ endian.h (working copy) @@ -65,9 +65,9 @@ #define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8) #define __bswap32_gen(x) \ - (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16)) + (((__uint32_t)__bswap16_gen(x) << 16) | __bswap16_gen((x) >> 16)) #define __bswap64_gen(x) \ - (((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32)) + (((__uint64_t)__bswap32_gen(x) << 32) | __bswap32_gen((x) >> 32)) #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P #define __bswap16(x) \ I ran into this while porting the __builtin_constant_p() functionality over to ia64. -- John Baldwin