* 2 of the License, or (at your option) any later version.
*/
#include <xen/bitops.h>
-
-#include <asm/byteorder.h>
+#include <xen/byteorder.h>
#define __ffs(x) (ffsl(x) - 1)
#define ffz(x) __ffs(~(x))
#ifdef __BIG_ENDIAN
-/* include/linux/byteorder does not support "unsigned long" type */
-static inline unsigned long ext2_swabp(const unsigned long * x)
-{
-#if BITS_PER_LONG == 64
- return (unsigned long) __swab64p((u64 *) x);
-#elif BITS_PER_LONG == 32
- return (unsigned long) __swab32p((u32 *) x);
-#else
-#error BITS_PER_LONG not defined
-#endif
-}
-
-/* include/linux/byteorder doesn't support "unsigned long" type */
-static inline unsigned long ext2_swab(const unsigned long y)
-{
-#if BITS_PER_LONG == 64
- return (unsigned long) __swab64((u64) y);
-#elif BITS_PER_LONG == 32
- return (unsigned long) __swab32((u32) y);
-#else
-#error BITS_PER_LONG not defined
-#endif
-}
-
#ifndef find_next_zero_bit_le
unsigned long find_next_zero_bit_le(const void *addr, unsigned
long size, unsigned long offset)
size -= result;
offset &= (BITS_PER_LONG - 1UL);
if (offset) {
- tmp = ext2_swabp(p++);
+ tmp = bswapl(*p++);
tmp |= (~0UL >> (BITS_PER_LONG - offset));
if (size < BITS_PER_LONG)
goto found_first;
}
if (!size)
return result;
- tmp = ext2_swabp(p);
+ tmp = bswapl(*p);
found_first:
tmp |= ~0UL << size;
if (tmp == ~0UL) /* Are any bits zero? */
return result + ffz(tmp);
found_middle_swap:
- return result + ffz(ext2_swab(tmp));
+ return result + ffz(bswapl(tmp));
}
EXPORT_SYMBOL(find_next_zero_bit_le);
#endif
size -= result;
offset &= (BITS_PER_LONG - 1UL);
if (offset) {
- tmp = ext2_swabp(p++);
+ tmp = bswapl(*p++);
tmp &= (~0UL << offset);
if (size < BITS_PER_LONG)
goto found_first;
}
if (!size)
return result;
- tmp = ext2_swabp(p);
+ tmp = bswapl(*p);
found_first:
tmp &= (~0UL >> (BITS_PER_LONG - size));
if (tmp == 0UL) /* Are any bits set? */
return result + __ffs(tmp);
found_middle_swap:
- return result + __ffs(ext2_swab(tmp));
+ return result + __ffs(bswapl(tmp));
}
EXPORT_SYMBOL(find_next_bit_le);
#endif