blob: b8696959c4b6d19447a72f7328417204ece50f5e [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
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
18static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
19{
20 __u32 t;
21
22#ifndef __thumb__
23 if (!__builtin_constant_p(x)) {
24
Martin Storsjo57751632010-12-08 09:33:51 +010025 __asm__ ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080026 } 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