aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/host-utils.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-02-01 23:03:16 +0100
committerBlue Swirl <blauwirbel@gmail.com>2013-02-02 20:16:00 +0000
commitfbeadf50f2f965741def823036b086bbc2999b1f (patch)
tree859da9be446ae21d999274d1972730a69e1de9ee /include/qemu/host-utils.h
parent7b2d9779818f4c0d4c31d3a0292bee1c4b633217 (diff)
downloadqemu-fbeadf50f2f965741def823036b086bbc2999b1f.zip
qemu-fbeadf50f2f965741def823036b086bbc2999b1f.tar.gz
qemu-fbeadf50f2f965741def823036b086bbc2999b1f.tar.bz2
bitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl
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 <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Andreas Färber <afaerber@suse.de> Tested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'include/qemu/host-utils.h')
-rw-r--r--include/qemu/host-utils.h26
1 files changed, 0 insertions, 26 deletions
diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h
index 2a32be4..81c9a75 100644
--- a/include/qemu/host-utils.h
+++ b/include/qemu/host-utils.h
@@ -26,7 +26,6 @@
#define HOST_UTILS_H 1
#include "qemu/compiler.h" /* QEMU_GNUC_PREREQ */
-#include <string.h> /* ffsl */
#if defined(__x86_64__)
#define __HAVE_FAST_MULU64__
@@ -238,29 +237,4 @@ static inline int ctpop64(uint64_t val)
#endif
}
-/* glibc does not provide an inline version of ffsl, so always define
- * ours. We need to give it a different name, however.
- */
-#ifdef __GLIBC__
-#define ffsl qemu_ffsl
-#endif
-static inline int ffsl(long val)
-{
- if (!val) {
- return 0;
- }
-
-#if QEMU_GNUC_PREREQ(3, 4)
- return __builtin_ctzl(val) + 1;
-#else
- if (sizeof(long) == 4) {
- return ctz32(val) + 1;
- } else if (sizeof(long) == 8) {
- return ctz64(val) + 1;
- } else {
- abort();
- }
-#endif
-}
-
#endif