OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / prebuilt / ndk / android-ndk-r4 / platforms / android-3 / arch-arm / usr / include / asm / byteorder.h
1 /****************************************************************************
2  ****************************************************************************
3  ***
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.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef __ASM_ARM_BYTEORDER_H
13 #define __ASM_ARM_BYTEORDER_H
14
15 #include <linux/compiler.h>
16 #include <asm/types.h>
17
18 static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
19 {
20  __u32 t;
21
22 #ifndef __thumb__
23  if (!__builtin_constant_p(x)) {
24
25  asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
26  } else
27 #endif
28  t = x ^ ((x << 16) | (x >> 16));
29
30  x = (x << 24) | (x >> 8);
31  t &= ~0x00FF0000;
32  x ^= (t >> 8);
33
34  return x;
35 }
36
37 #define __arch__swab32(x) ___arch__swab32(x)
38
39 #ifndef __STRICT_ANSI__
40 #define __BYTEORDER_HAS_U64__
41 #define __SWAB_64_THRU_32__
42 #endif
43
44 #ifdef __ARMEB__
45 #include <linux/byteorder/big_endian.h>
46 #else
47 #include <linux/byteorder/little_endian.h>
48 #endif
49
50 #endif
51