File: /usr/src/linux/include/asm-cris/byteorder.h
1 /* $Id: byteorder.h,v 1.1 2000/07/10 16:32:31 bjornw Exp $ */
2
3 #ifndef _CRIS_BYTEORDER_H
4 #define _CRIS_BYTEORDER_H
5
6 #include <asm/types.h>
7
8 #ifdef __GNUC__
9
10 /* we just define these two (as we can do the swap in a single
11 * asm instruction in CRIS) and the arch-independent files will put
12 * them together into ntohl etc.
13 */
14
15 static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
16 {
17 __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
18
19 return(x);
20 }
21
22 static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
23 {
24 __asm__ ("swapb %0" : "=r" (x) : "0" (x));
25
26 return(x);
27 }
28
29 /* defines are necessary because the other files detect the presence
30 * of a defined __arch_swab32, not an inline
31 */
32
33 #define __arch__swab32(x) ___arch__swab32(x)
34 #define __arch__swab16(x) ___arch__swab16(x)
35
36 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
37 # define __BYTEORDER_HAS_U64__
38 # define __SWAB_64_THRU_32__
39 #endif
40
41 #endif /* __GNUC__ */
42
43 #include <linux/byteorder/little_endian.h>
44
45 #endif
46
47
48