]> git.proxmox.com Git - mirror_qemu.git/commitdiff
host-utils: Add host long specific aliases for clz, ctz, ctpop
authorRichard Henderson <rth@twiddle.net>
Thu, 14 Feb 2013 01:47:34 +0000 (17:47 -0800)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 16 Feb 2013 11:09:05 +0000 (11:09 +0000)
We will standardize on these names, rather than the similar routines
currently residing in qemu/bitops.h.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
include/qemu/host-utils.h

index 81c9a754ae2db2af6c8a70b4ebe08ff697b2dd4c..d72b72d88f3770d8426fc391e867b6bee2b7c2c6 100644 (file)
@@ -26,6 +26,7 @@
 #define HOST_UTILS_H 1
 
 #include "qemu/compiler.h"   /* QEMU_GNUC_PREREQ */
+#include <limits.h>
 
 #if defined(__x86_64__)
 #define __HAVE_FAST_MULU64__
@@ -237,4 +238,22 @@ static inline int ctpop64(uint64_t val)
 #endif
 }
 
+/* Host type specific sizes of these routines.  */
+
+#if ULONG_MAX == UINT32_MAX
+# define clzl   clz32
+# define ctzl   ctz32
+# define clol   clo32
+# define ctol   cto32
+# define ctpopl ctpop32
+#elif ULONG_MAX == UINT64_MAX
+# define clzl   clz64
+# define ctzl   ctz64
+# define clol   clo64
+# define ctol   cto64
+# define ctpopl ctpop64
+#else
+# error Unknown sizeof long
+#endif
+
 #endif