1 /* 2 * byteswap.h 3 * 4 * $Id: byteswap.h,v 1.1 2012-04-20 15:46:39 stefano Exp $ 5 */ 6 7 #ifndef _BYTESWAP_H 8 #define _BYTESWAP_H 9 10 #include <sys/compiler.h> 11 12 bswap_16(unsigned int __x)13unsigned int bswap_16 (unsigned int __x) 14 { 15 return (__x >> 8) | (__x << 8); 16 } 17 bswap_32(unsigned long __x)18unsigned long bswap_32 (unsigned long __x) 19 { 20 return (bswap_16 (__x & 0xffff) << 16) | (bswap_16 (__x >> 16)); 21 } 22 23 24 25 #endif /*_BYTESWAP_H*/ 26 27