mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
utils: add clzll
Check for __builtin_clzll and add wrapper when missing.
This commit is contained in:
parent
8215e3503d
commit
6c84a36b53
44
configure
vendored
44
configure
vendored
@ -6581,6 +6581,50 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_clzll" >&5
|
||||||
|
$as_echo_n "checking for __builtin_clzll... " >&6; }
|
||||||
|
if ${ax_cv_have___builtin_clzll+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
__builtin_clzll(0)
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ax_cv_have___builtin_clzll=yes
|
||||||
|
else
|
||||||
|
ax_cv_have___builtin_clzll=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have___builtin_clzll" >&5
|
||||||
|
$as_echo "$ax_cv_have___builtin_clzll" >&6; }
|
||||||
|
|
||||||
|
if test yes = $ax_cv_have___builtin_clzll; then :
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE___BUILTIN_CLZLL 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
for ac_func in ftruncate gethostname getpagesize gettimeofday localtime_r \
|
for ac_func in ftruncate gethostname getpagesize gettimeofday localtime_r \
|
||||||
memchr memset mkdir mkfifo munmap nl_langinfo realpath rmdir setenv \
|
memchr memset mkdir mkfifo munmap nl_langinfo realpath rmdir setenv \
|
||||||
|
@ -140,6 +140,7 @@ AC_TYPE_UINT16_T
|
|||||||
AC_TYPE_UINT32_T
|
AC_TYPE_UINT32_T
|
||||||
AC_TYPE_UINT64_T
|
AC_TYPE_UINT64_T
|
||||||
AX_GCC_BUILTIN([__builtin_clz])
|
AX_GCC_BUILTIN([__builtin_clz])
|
||||||
|
AX_GCC_BUILTIN([__builtin_clzll])
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
dnl -- Check for functions
|
dnl -- Check for functions
|
||||||
|
@ -528,6 +528,9 @@
|
|||||||
/* Define to 1 if the system has the `__builtin_clz' built-in function */
|
/* Define to 1 if the system has the `__builtin_clz' built-in function */
|
||||||
#undef HAVE___BUILTIN_CLZ
|
#undef HAVE___BUILTIN_CLZ
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the `__builtin_clzll' built-in function */
|
||||||
|
#undef HAVE___BUILTIN_CLZLL
|
||||||
|
|
||||||
/* Internalization package */
|
/* Internalization package */
|
||||||
#undef INTL_PACKAGE
|
#undef INTL_PACKAGE
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#ifdef HAVE___BUILTIN_CLZ
|
#ifdef HAVE___BUILTIN_CLZ
|
||||||
#define clz(x) __builtin_clz((x))
|
#define clz(x) __builtin_clz((x))
|
||||||
#else /* ifdef HAVE___BUILTIN_CLZ */
|
#else /* ifdef HAVE___BUILTIN_CLZ */
|
||||||
unsigned _dm_clz(unsigned x)
|
static unsigned _dm_clz(unsigned x)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@ -76,6 +76,19 @@ unsigned _dm_clz(unsigned x)
|
|||||||
#define clz(x) _dm_clz((x))
|
#define clz(x) _dm_clz((x))
|
||||||
#endif /* ifdef HAVE___BUILTIN_CLZ */
|
#endif /* ifdef HAVE___BUILTIN_CLZ */
|
||||||
|
|
||||||
|
#ifdef HAVE___BUILTIN_CLZLL
|
||||||
|
#define clzll(x) __builtin_clzll((x))
|
||||||
|
#else /* ifdef HAVE___BUILTIN_CLZ */
|
||||||
|
static unsigned _dm_clzll(unsigned long long x)
|
||||||
|
{
|
||||||
|
if (x <= 0xffffffff)
|
||||||
|
return 32 + clz((unsigned) (x & 0xffffffff));
|
||||||
|
|
||||||
|
return clz(x >> 32);
|
||||||
|
}
|
||||||
|
#define clzll(x) _dm_clzll((x))
|
||||||
|
#endif /* ifdef HAVE___BUILTIN_CLZLL */
|
||||||
|
|
||||||
#define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release))
|
#define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release))
|
||||||
|
|
||||||
/* Define some portable printing types */
|
/* Define some portable printing types */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user