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
Ben Cheng4b29af02012-03-07 16:14:53 -080014
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015#include <linux/compiler.h>
16#include <asm/types.h>
Ben Cheng4b29af02012-03-07 16:14:53 -080017
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
19{
20 __u32 t;
Ben Cheng4b29af02012-03-07 16:14:53 -080021
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080022#ifndef __thumb__
23 if (!__builtin_constant_p(x)) {
Ben Cheng4b29af02012-03-07 16:14:53 -080024
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));
Ben Cheng4b29af02012-03-07 16:14:53 -080029
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030 x = (x << 24) | (x >> 8);
31 t &= ~0x00FF0000;
32 x ^= (t >> 8);
Ben Cheng4b29af02012-03-07 16:14:53 -080033
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034 return x;
35}
Ben Cheng4b29af02012-03-07 16:14:53 -080036
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080037#define __arch__swab32(x) ___arch__swab32(x)
Ben Cheng4b29af02012-03-07 16:14:53 -080038
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080039#ifndef __STRICT_ANSI__
40#define __BYTEORDER_HAS_U64__
41#define __SWAB_64_THRU_32__
42#endif
Ben Cheng4b29af02012-03-07 16:14:53 -080043
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080044#ifdef __ARMEB__
45#include <linux/byteorder/big_endian.h>
46#else
47#include <linux/byteorder/little_endian.h>
48#endif
Ben Cheng4b29af02012-03-07 16:14:53 -080049
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080050#endif
Ben Cheng4b29af02012-03-07 16:14:53 -080051