From owner-svn-src-head@FreeBSD.ORG Fri Mar 2 21:56:33 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 A5B1E1065670; Fri, 2 Mar 2012 21:56:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 1E2BC8FC19; Fri, 2 Mar 2012 21:56:32 +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 mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q22LuTMq020555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 3 Mar 2012 08:56:30 +1100 Date: Sat, 3 Mar 2012 08:56:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tijl Coosemans In-Reply-To: <201203022129.10849.tijl@freebsd.org> Message-ID: <20120303084934.L888@besplex.bde.org> References: <201202281939.q1SJdtYr084858@svn.freebsd.org> <20120302130435.J929@besplex.bde.org> <20120302223355.Q2543@besplex.bde.org> <201203022129.10849.tijl@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, Dimitry Andric , Bruce Evans Subject: Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include 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, 02 Mar 2012 21:56:33 -0000 On Fri, 2 Mar 2012, Tijl Coosemans wrote: > On Friday 02 March 2012 12:52:41 Bruce Evans wrote: >> ... >> Here is another version. It has now been tested a bit at runtime. >> I had to restore almost all of the complications, so the following >> reduces to mostly style changes including comments about surprising >> details. It has 1 fix for clang (the comitted version doesn't >> work for clang). >> ... >> % -#define _BYTEORDER_FUNC_DEFINED >> % +/* XXX these are broken, since they evaluate x more than once. */ > > Maybe make them static inline functions. That won't be very efficient at > -O0 but it'll be correct and this implementation probably isn't very > efficient anyway. Otherwise the patch looks good to me. > >> % +#define __bswap16(x) (__bswap16_gen((__uint16_t)(x))) >> % +#define __bswap32(x) (__bswap32_gen((__uint32_t)(x))) >> % +#define __bswap64(x) (__bswap64_gen((__uint64_t)(x))) They are already static inline for the gcc `var' case, and that would work for any compiler if the asms in them were ifdefed. The problem is the lack of __builtin_const_p() for non-gcc. This is only needed for the `const' case, since the static inlines don't work in static initializers. OTOH, the only thing that stops the generic expressions working in the `var' case is their side effects. Bruce