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 --- memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'memory.c') diff --git a/memory.c b/memory.c index 410c5f80b4..cd7d5e0cf5 100644 --- a/memory.c +++ b/memory.c @@ -855,7 +855,7 @@ static uint64_t memory_region_dispatch_read1(MemoryRegion *mr, } if (!mr->ops->read) { - return mr->ops->old_mmio.read[bitops_ffsl(size)](mr->opaque, addr); + return mr->ops->old_mmio.read[bitops_ctzl(size)](mr->opaque, addr); } /* FIXME: support unaligned access */ @@ -908,7 +908,7 @@ static void memory_region_dispatch_write(MemoryRegion *mr, adjust_endianness(mr, &data, size); if (!mr->ops->write) { - mr->ops->old_mmio.write[bitops_ffsl(size)](mr->opaque, addr, data); + mr->ops->old_mmio.write[bitops_ctzl(size)](mr->opaque, addr, data); return; } -- cgit v1.2.3