From 9d2a22c94ae99f9301321082c4fb8d73f4085fda Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 15 Jan 2015 10:04:43 +0100 Subject: Add functions to count trailing zero bits in a word. * cipher/bithelp.h (_gcry_ctz, _gcry_ctz64): New. * configure.ac (HAVE_BUILTIN_CTZ): Add new test. -- Note that these functions return the number of bits in the word when passing 0. Signed-off-by: Werner Koch --- configure.ac | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 4cfebe7b..4bbd686c 100644 --- a/configure.ac +++ b/configure.ac @@ -826,6 +826,21 @@ if test "$gcry_cv_have_builtin_bswap64" = "yes" ; then fi +# +# Check for __builtin_ctz intrinsic. +# +AC_CACHE_CHECK(for __builtin_ctz, + [gcry_cv_have_builtin_ctz], + [gcry_cv_have_builtin_ctz=no + AC_LINK_IFELSE([AC_LANG_PROGRAM([], + [unsigned int x = 0; int y = __builtin_ctz(x); return y;])], + [gcry_cv_have_builtin_ctz=yes])]) +if test "$gcry_cv_have_builtin_ctz" = "yes" ; then + AC_DEFINE(HAVE_BUILTIN_CTZ, 1, + [Defined if compiler has '__builtin_ctz' intrinsic]) +fi + + # # Check for VLA support (variable length arrays). # -- cgit v1.2.1