Update of /cvsroot/linux-vax/kernel/include/asm-vax
In directory usw-pr-cvs1:/tmp/cvs-serv28266
Modified Files:
byteorder.h
Log Message:
backport of byteorder.h from 2.4
Index: byteorder.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel/include/asm-vax/byteorder.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** byteorder.h 2000/03/07 22:12:30 1.1
--- byteorder.h 2001/01/20 12:36:16 1.2
***************
*** 6,9 ****
--- 6,50 ----
#include <asm/types.h>
+ #ifdef __GNUC__
+
+ static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
+ {
+ __u32 t1, t2; /* assume input is aabbccdd in x*/
+
+ __asm__("clrl %0\n\t" /* clear t1 */
+ "rotl $8, %2, %1\n\t" /* %1 = bbccddaa */
+ "bisl3 $0xff00ff, %1, %0\n\t" /* %0 = 00cc00aa */
+ "rotl $-8, %2, %1\n\t" /* %1 = ddaabbcc */
+ "bicl2 $0xff00ff, %1\n\t" /* %1 = dd00bb00 */
+ "bisl2 %1, %0\n\t" /* %0 = ddccbbaa */
+ : "=g" (t1), "=g" (t2) : "g" (x) );
+ return t1;
+ }
+
+ static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
+ {
+ __u32 t1, t2, t3;
+ __asm__("clrl %2\n\t"
+ "movw %3,%2\n\t" /* %2=0000aabb */
+ "rotl $-8,%2,%0\n\t" /* %0=bb0000aa */
+ "ashl $24,%0,%1\n\t" /* %1=aa000000 */
+ "rotl $8,%1,%0\n\t" /* %0=000000aa */
+ "ashl $8,%2,%1\n\t" /* %1=00aabb00 */
+ "bicl2 $0xfffff00ff, %1\n\t" /* %1=0000bb00 */
+ "addl2 %1,%0\n\t" /* %0=0000bbaa */
+ : "=g" (t1), "=g" (t2), "=g"(t3) : "g" (x));
+ return (__u16) t1;
+ }
+
+ #define __arch__swab32(x) ___arch__swab32(x)
+ #define __arch__swab16(x) ___arch__swab16(x)
+
+ #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
+ # define __BYTEORDER_HAS_U64__
+ # define __SWAB_64_THRU_32__
+ #endif
+
+ #endif /* __GNUC__ */
+
#include <linux/byteorder/little_endian.h>
|