On Fri, Mar 30, 2012 at 02:11:21PM +0200, Dimitry Andric wrote: > In case of the __bswapXX() macros, you can see that the argument to > __bswapXX_gen() is first explicitly cast to an unsigned type, for > example with __bswap32(): > > #define __bswap32(x) \ > (__builtin_constant_p(x) ? \ > __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) > > Therefore, right shifting will not give any problems. For the call to > __bswap32_var(), such casting is not needed, since the argument will be > implicitly converted to __uint32_t. > > As Bruce has mentioned, you could add more explicit casts and additional > parentheses, but those would be superfluous.
I mention right shift just as potential problem. I really want to target casting vs. masking problem (masking provide more instructions). bde@ already suggest the same thing I generally mean in more details in his recent answer with the patch: % + __bswap16_gen((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x)))) -- http://ache.vniz.net/ _______________________________________________ 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"