1 #ifndef ETHERBOOT_BITS_BYTESWAP_H
2 #define ETHERBOOT_BITS_BYTESWAP_H
4 FILE_LICENCE ( GPL2_OR_LATER
);
6 static inline __attribute__ ((always_inline
, const)) uint16_t
7 __bswap_variable_16(uint16_t x
)
9 __asm__("xchgb %b0,%h0\n\t"
15 static inline __attribute__ ((always_inline
, const)) uint32_t
16 __bswap_variable_32(uint32_t x
)
18 __asm__("xchgb %b0,%h0\n\t"
26 static inline __attribute__ ((always_inline
, const)) uint64_t
27 __bswap_variable_64(uint64_t x
)
35 u
.dword
[0] = __bswap_variable_32(u
.dword
[0]);
36 u
.dword
[1] = __bswap_variable_32(u
.dword
[1]);
38 : "=r" ( u
.dword
[0] ), "=r" ( u
.dword
[1] )
39 : "0" ( u
.dword
[0] ), "1" ( u
.dword
[1] ) );
43 #endif /* ETHERBOOT_BITS_BYTESWAP_H */