Linux-2.6.12-rc2
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / asm-v850 / byteorder.h
1 /*
2 * include/asm-v850/byteorder.h -- Endian id and conversion ops
3 *
4 * Copyright (C) 2001 NEC Corporation
5 * Copyright (C) 2001 Miles Bader <miles@gnu.org>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
10 *
11 * Written by Miles Bader <miles@gnu.org>
12 */
13
14 #ifndef __V850_BYTEORDER_H__
15 #define __V850_BYTEORDER_H__
16
17 #include <asm/types.h>
18 #include <linux/compiler.h>
19
20 #ifdef __GNUC__
21
22 static __inline__ __attribute_const__ __u32 ___arch__swab32 (__u32 word)
23 {
24 __u32 res;
25 __asm__ ("bsw %1, %0" : "=r" (res) : "r" (word));
26 return res;
27 }
28
29 static __inline__ __attribute_const__ __u16 ___arch__swab16 (__u16 half_word)
30 {
31 __u16 res;
32 __asm__ ("bsh %1, %0" : "=r" (res) : "r" (half_word));
33 return res;
34 }
35
36 #define __arch__swab32(x) ___arch__swab32(x)
37 #define __arch__swab16(x) ___arch__swab16(x)
38
39 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
40 # define __BYTEORDER_HAS_U64__
41 # define __SWAB_64_THRU_32__
42 #endif
43
44 #endif /* __GNUC__ */
45
46 #include <linux/byteorder/little_endian.h>
47
48 #endif /* __V850_BYTEORDER_H__ */