1 /****************************************************************************
2 ****************************************************************************
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
10 ****************************************************************************
11 ****************************************************************************/
12 #ifndef _ASM_X86_BYTEORDER_H
13 #define _ASM_X86_BYTEORDER_H
15 #include <asm/types.h>
16 #include <linux/compiler.h>
22 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
24 __asm__("xchgb %b0,%h0\n\t"
32 static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
35 struct { __u32 a,b; } s;
39 v.s.a = ___arch__swab32(v.s.a);
40 v.s.b = ___arch__swab32(v.s.b);
41 __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
47 static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
49 __asm__("bswapq %0" : "=r" (x) : "0" (x));
53 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
55 __asm__("bswapl %0" : "=r" (x) : "0" (x));
61 #define __arch__swab64(x) ___arch__swab64(x)
62 #define __arch__swab32(x) ___arch__swab32(x)
64 #define __BYTEORDER_HAS_U64__
68 #include <linux/byteorder/little_endian.h>