Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver...
[linux-2.6/verdex.git] / include / asm-v850 / byteorder.h
bloba6f07530050e54eb729f402a8456121601f88274
1 /*
2 * include/asm-v850/byteorder.h -- Endian id and conversion ops
4 * Copyright (C) 2001 NEC Corporation
5 * Copyright (C) 2001 Miles Bader <miles@gnu.org>
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.
11 * Written by Miles Bader <miles@gnu.org>
14 #ifndef __V850_BYTEORDER_H__
15 #define __V850_BYTEORDER_H__
17 #include <asm/types.h>
18 #include <linux/compiler.h>
20 #ifdef __GNUC__
22 static __inline__ __attribute_const__ __u32 ___arch__swab32 (__u32 word)
24 __u32 res;
25 __asm__ ("bsw %1, %0" : "=r" (res) : "r" (word));
26 return res;
29 static __inline__ __attribute_const__ __u16 ___arch__swab16 (__u16 half_word)
31 __u16 res;
32 __asm__ ("bsh %1, %0" : "=r" (res) : "r" (half_word));
33 return res;
36 #define __arch__swab32(x) ___arch__swab32(x)
37 #define __arch__swab16(x) ___arch__swab16(x)
39 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
40 # define __BYTEORDER_HAS_U64__
41 # define __SWAB_64_THRU_32__
42 #endif
44 #endif /* __GNUC__ */
46 #include <linux/byteorder/little_endian.h>
48 #endif /* __V850_BYTEORDER_H__ */