Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98047
b: refs/heads/master
c: 69c5ddf
h: refs/heads/master
i:
  98045: f65e11c
  98043: b35f150
  98039: 2b45147
  98031: 06819f0
  98015: d5a0bb7
  97983: db5a2bc
  97919: cce120f
  97791: 9c65fb1
v: v3
  • Loading branch information
Aneesh Kumar K.V authored and Linus Torvalds committed Jun 13, 2008
1 parent 9145513 commit 1c92244
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2d518f84e5ecd1d71df0e6ac5176d212f68c27ce
refs/heads/master: 69c5ddf58a03da3686691ad2f293bc79fd977c10
45 changes: 43 additions & 2 deletions trunk/include/asm-m68k/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,49 @@ static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
return (p - addr) * 32 + res;
}
#define ext2_find_next_bit(addr, size, off) \
generic_find_next_le_bit((unsigned long *)(addr), (size), (off))

static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
{
const unsigned long *p = vaddr, *addr = vaddr;
int res;

if (!size)
return 0;

size = (size >> 5) + ((size & 31) > 0);
while (*p++ == 0UL) {
if (--size == 0)
return (p - addr) << 5;
}

--p;
for (res = 0; res < 32; res++)
if (ext2_test_bit(res, p))
break;
return (p - addr) * 32 + res;
}

static inline int ext2_find_next_bit(const void *vaddr, unsigned size,
unsigned offset)
{
const unsigned long *addr = vaddr;
const unsigned long *p = addr + (offset >> 5);
int bit = offset & 31UL, res;

if (offset >= size)
return size;

if (bit) {
/* Look for one in first longword */
for (res = bit; res < 32; res++)
if (ext2_test_bit(res, p))
return (p - addr) * 32 + res;
p++;
}
/* No set bit yet, search remaining full bytes for a set bit */
res = ext2_find_first_bit(p, size - 32 * (p - addr));
return (p - addr) * 32 + res;
}

#endif /* __KERNEL__ */

Expand Down

0 comments on commit 1c92244

Please sign in to comment.