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/bitops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util/bitops.c') diff --git a/util/bitops.c b/util/bitops.c index 4c3a836a01..7b853cf944 100644 --- a/util/bitops.c +++ b/util/bitops.c @@ -60,7 +60,7 @@ found_first: return result + size; /* Nope. */ } found_middle: - return result + bitops_ffsl(tmp); + return result + bitops_ctzl(tmp); } /* @@ -109,7 +109,7 @@ found_first: return result + size; /* Nope. */ } found_middle: - return result + ffz(tmp); + return result + bitops_ctol(tmp); } unsigned long find_last_bit(const unsigned long *addr, unsigned long size) -- cgit v1.2.3