exec: replace ffsl with ctzl
authorNatanael Copa <ncopa@alpinelinux.org>
Tue, 29 Apr 2014 14:17:30 +0000 (16:17 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 10 Jun 2014 23:25:06 +0000 (00:25 +0100)
See commit fbeadf50 (bitops: unify bitops_ffsl with the one in
host-utils.h, call it bitops_ctzl) on why ctzl should be used instead
of ffsl.

This is also needed for musl libc which does not implement ffsl.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
include/exec/ram_addr.h

index 2edfa96c6dd10e8af541d9c99268c9403714404e..b94de02ea755d08abbf556ccf9a3910010b47b6d 100644 (file)
@@ -117,7 +117,7 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
             if (bitmap[i] != 0) {
                 c = leul_to_cpu(bitmap[i]);
                 do {
-                    j = ffsl(c) - 1;
+                    j = ctzl(c);
                     c &= ~(1ul << j);
                     page_number = (i * HOST_LONG_BITS + j) * hpratio;
                     addr = page_number * TARGET_PAGE_SIZE;