cleanup qemu/util code

This commit is contained in:
Nguyen Anh Quynh
2017-01-10 12:57:12 +08:00
parent fdbbdc6216
commit c1f39c3db2
21 changed files with 1 additions and 1664 deletions

View File

@ -127,32 +127,3 @@ found_first:
found_middle:
return result + ctzl(~tmp);
}
unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
{
unsigned long words;
unsigned long tmp;
/* Start at final word. */
words = size / BITS_PER_LONG;
/* Partial final word? */
if (size & (BITS_PER_LONG-1)) {
tmp = (addr[words] & (~0UL >> (BITS_PER_LONG
- (size & (BITS_PER_LONG-1)))));
if (tmp) {
goto found;
}
}
while (words) {
tmp = addr[--words];
if (tmp) {
found:
return words * BITS_PER_LONG + BITS_PER_LONG - 1 - clzl(tmp);
}
}
/* Not found */
return size;
}