From: Richard Henderson Date: Thu, 14 Feb 2013 01:47:34 +0000 (-0800) Subject: host-utils: Add host long specific aliases for clz, ctz, ctpop X-Git-Tag: v1.5.0-rc0~687 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0165437302448d210742cc3def362d1de0413621;p=thirdparty%2Fqemu.git host-utils: Add host long specific aliases for clz, ctz, ctpop We will standardize on these names, rather than the similar routines currently residing in qemu/bitops.h. Signed-off-by: Richard Henderson Reviewed-by: Eric Blake Signed-off-by: Blue Swirl --- diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 81c9a754ae2..d72b72d88f3 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -26,6 +26,7 @@ #define HOST_UTILS_H 1 #include "qemu/compiler.h" /* QEMU_GNUC_PREREQ */ +#include #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