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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to