From fbeadf50f2f965741def823036b086bbc2999b1f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 1 Feb 2013 23:03:16 +0100 Subject: bitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We had two copies of a ffs function for longs with subtly different semantics and, for the one in bitops.h, a confusing name: the result was off-by-one compared to the library function ffsl. Unify the functions into one, and solve the name problem by calling the 0-based functions "bitops_ctzl" and "bitops_ctol" respectively. This also fixes the build on platforms with ffsl, including Mac OS X and Windows. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Tested-by: Andreas Färber Tested-by: Peter Maydell Signed-off-by: Blue Swirl --- util/hbitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/hbitmap.c') diff --git a/util/hbitmap.c b/util/hbitmap.c index 2aa487d..a0df5d3 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -126,7 +126,7 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi) * The index of this word's least significant set bit provides * the low-order bits. */ - pos = (pos << BITS_PER_LEVEL) + ffsl(cur) - 1; + pos = (pos << BITS_PER_LEVEL) + bitops_ctzl(cur); hbi->cur[i] = cur & (cur - 1); /* Set up next level for iteration. */ -- cgit v1.1