
On 9/6/11, Phil Endecott <spam_from_boost_dev@chezphil.org> wrote:
Could you post the important bits of your byte_swapper::reverse() to the list?
For which compiler ? (-: 16-bit un-optimized version: return (x >> 8) | (x << 8); 32-bit un-optimized version (edited for space): return uint32_t (reverse16 (uint16_t (x >> 16))) | (uint32_t (reverse16 (uint16_t (x ))) << 16); 64-bit un-optimized version (edited for space): return uint64_t (reverse32 (uint32_t (x >> 32))) | (uint64_t (reverse32 (uint32_t (x ))) << 32); GCC 32-bit and 64-bit optimized versions use __builtin_bswap32 and __builtin_bswap64, with a warning in the documentation pointing to the http://hardwarebug.org/2010/01/14/beware-the-builtins link that has just been posted to this list.