2 * include/asm-microblaze/byteorder.h -- Endian id and conversion ops
4 * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
5 * Copyright (C) 2001 NEC Corporation
6 * Copyright (C) 2001 Miles Bader <miles@gnu.org>
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this
10 * archive for more details.
12 * Written by Miles Bader <miles@gnu.org>
13 * Microblaze port by John Williams
16 #ifndef __MICROBLAZE_BYTEORDER_H__
17 #define __MICROBLAZE_BYTEORDER_H__
19 #include <asm/types.h>
23 /* This is effectively a dupe of the arch-independent byteswap
24 code in include/linux/byteorder/swab.h, however we force a cast
25 of the result up to 32 bits. This in turn forces the compiler
26 to explicitly clear the high 16 bits, which it wasn't doing otherwise.
28 I think this is a symptom of a bug in mb-gcc. JW 20040303
32 static __inline__ __u16 ___arch__swab16 (__u16 half_word)
34 /* 32 bit temp to cast result, forcing clearing of high word */
37 temp = ((half_word & 0x00FFU) << 8) | ((half_word & 0xFF00U) >> 8);
42 #define __arch__swab16(x) ___arch__swab16(x)
44 /* Microblaze has no arch-specific endian conversion insns */
46 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
47 # define __BYTEORDER_HAS_U64__
48 # define __SWAB_64_THRU_32__
53 #include <linux/byteorder/big_endian.h>
55 #endif /* __MICROBLAZE_BYTEORDER_H__ */