recent commit to pirofti made me wonder why don't we take an advantage of the 64 bit bswap instruction on amd64?
Index: arch/amd64/include/endian.h =================================================================== RCS file: /home/cvs/src/sys/arch/amd64/include/endian.h,v retrieving revision 1.3 diff -u -p -r1.3 endian.h --- arch/amd64/include/endian.h 13 Dec 2005 00:35:22 -0000 1.3 +++ arch/amd64/include/endian.h 11 Mar 2011 15:47:40 -0000 @@ -36,12 +36,11 @@ __swap32md_x; \ }) -/* XXX - I'm sure there is a better way on this cpu. */ #define __swap64md(x) ({ \ u_int64_t __swap64md_x = (x); \ \ - (u_int64_t)__swap32md(__swap64md_x >> 32) | \ - (u_int64_t)__swap32md(__swap64md_x & 0xffffffff) << 32; \ + __asm ("bswapq %1" : "+r" (__swap64md_x)); \ + __swap64md_x; \ }) #define __swap16md(x) ({ \