patch-2.0.21-2.1.0 linux/include/asm-m68k/bitops.h
Next file: linux/include/asm-m68k/bootinfo.h
Previous file: linux/include/asm-m68k/atariints.h
Back to the patch index
Back to the overall index
- Lines: 64
- Date:
Wed Sep 25 10:47:41 1996
- Orig file:
lx2.0/v2.0.21/linux/include/asm-m68k/bitops.h
- Orig date:
Mon May 20 07:54:29 1996
diff -u --recursive --new-file lx2.0/v2.0.21/linux/include/asm-m68k/bitops.h linux/include/asm-m68k/bitops.h
@@ -59,11 +59,11 @@
if (!size)
return 0;
+ size = (size >> 5) + ((size & 31) > 0);
while (*p++ == allones)
{
- if (size <= 32)
+ if (--size == 0)
return (p - addr) << 5;
- size -= 32;
}
num = ~*--p;
@@ -123,11 +123,11 @@
if (!size)
return 0;
+ size = (size >> 4) + ((size & 15) > 0);
while (*p++ == 0xffff)
{
- if (size <= 16)
+ if (--size == 0)
return (p - addr) << 4;
- size -= 16;
}
num = ~*--p;
@@ -203,11 +203,11 @@
if (!size)
return 0;
+ size = (size >> 5) + ((size & 31) > 0);
while (*p++ == ~0UL)
{
- if (size <= 32)
+ if (--size == 0)
return (p - addr) << 5;
- size -= 32;
}
--p;
@@ -237,6 +237,21 @@
/* No zero yet, search remaining full bytes for a zero */
res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
return (p - addr) * 32 + res;
+}
+
+/* Byte swapping. */
+
+extern __inline__ unsigned short
+swab16 (unsigned short val)
+{
+ return (val << 8) | (val >> 8);
+}
+
+extern __inline__ unsigned int
+swab32 (unsigned int val)
+{
+ __asm__ ("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
+ return val;
}
#endif /* _M68K_BITOPS_H */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov