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