1 #ifndef _BITS_BYTESWAP_H 2 #define _BITS_BYTESWAP_H 3 4 static inline __attribute__ (( always_inline, const )) uint16_t 5 __bswap_variable_16 ( uint16_t x ) { 6 __asm__ ( "xchgb %b0,%h0" : "=Q" ( x ) : "0" ( x ) ); 7 return x; 8 } 9 10 static inline __attribute__ (( always_inline, const )) uint32_t 11 __bswap_variable_32 ( uint32_t x ) { 12 __asm__ ( "bswapl %k0" : "=r" ( x ) : "0" ( x ) ); 13 return x; 14 } 15 16 static inline __attribute__ (( always_inline, const )) uint64_t 17 __bswap_variable_64 ( uint64_t x ) { 18 __asm__ ( "bswapq %q0" : "=r" ( x ) : "0" ( x ) ); 19 return x; 20 } 21 22 #endif /* _BITS_BYTESWAP_H */ 23