Date: Fri, 30 Mar 2012 21:25:38 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Dimitry Andric <dim@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r233683 - head/sys/x86/include Message-ID: <20120330211008.K1071@besplex.bde.org> In-Reply-To: <201203292330.q2TNUHbu014843@svn.freebsd.org> References: <201203292330.q2TNUHbu014843@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120330211008.K1071>