1 #ifndef _ASM_X86_BYTEORDER_H
2 #define _ASM_X86_BYTEORDER_H
5 #include <linux/compiler.h>
7 #define __LITTLE_ENDIAN
9 static inline __attribute_const__ __u32
__arch_swab32(__u32 val
)
12 # ifdef CONFIG_X86_BSWAP
13 asm("bswap %0" : "=r" (val
) : "0" (val
));
15 asm("xchgb %b0,%h0\n\t" /* swap lower bytes */
16 "rorl $16,%0\n\t" /* swap words */
17 "xchgb %b0,%h0" /* swap higher bytes */
29 #define __arch_swab32 __arch_swab32
31 static inline __attribute_const__ __u64
__arch_swab64(__u64 val
)
42 # ifdef CONFIG_X86_BSWAP
43 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
44 : "=r" (v
.s
.a
), "=r" (v
.s
.b
)
45 : "0" (v
.s
.a
), "1" (v
.s
.b
));
47 v
.s
.a
= __arch_swab32(v
.s
.a
);
48 v
.s
.b
= __arch_swab32(v
.s
.b
);
50 : "=r" (v
.s
.a
), "=r" (v
.s
.b
)
51 : "0" (v
.s
.a
), "1" (v
.s
.b
));
61 #define __arch_swab64 __arch_swab64
63 #include <linux/byteorder.h>
65 #endif /* _ASM_X86_BYTEORDER_H */