]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
So apparently, some platforms don't have ffsll(3).
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 2 Dec 2009 03:26:16 +0000 (03:26 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 2 Dec 2009 03:26:16 +0000 (03:26 +0000)
The manpage lies; it says that the function is in POSIX, but that's only for
ffs(3), not ffsll(3).

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@232164 65c4cc65-6c06-0410-ace0-fbb531ad65f3

configure
configure.ac
include/asterisk/autoconfig.h.in
include/asterisk/compat.h
main/strcompat.c

index 3a883e93672e302073b1d9a30bab7fa64a7d0173..0dc72584d9981a6d68ac7e8144aeebe4ba8bb64b 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 227579 .
+# From configure.ac Revision: 227580 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk 1.6.
 #
@@ -16715,7 +16715,8 @@ done
 
 
 
-for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
+
+for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
index 3cd4268ce34f358b049fbad42988da32877668ad..9b502b5e1ed5a83599312793498896685d355299 100644 (file)
@@ -390,7 +390,7 @@ AC_FUNC_STRNLEN
 AC_FUNC_STRTOD
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
+AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
 
 # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
 # so that AC_CHECK_FUNCS can detect functions in that library.
index fb38adc6f382c5d53f2a9a383abb957048263e57..706db3ce2a0a0f0a34255494f55a61608e914fbe 100644 (file)
 /* Define to the version of the Ffmpeg and avcodec library library. */
 #undef HAVE_FFMPEG_VERSION
 
+/* Define to 1 if you have the `ffsll' function. */
+#undef HAVE_FFSLL
+
 /* Define to 1 if you have the `floor' function. */
 #undef HAVE_FLOOR
 
index 8f2512a28152d37eea25b66e119ef9afb609bbe8..8d973f6c4a8370ac0c74d09a1471377f41fbfee8 100644 (file)
 int __attribute__((format(printf, 2, 3))) asprintf(char **str, const char *fmt, ...);
 #endif
 
+#ifndef HAVE_FFSLL
+int ffsll(long long n);
+#endif
+
 #ifndef HAVE_GETLOADAVG
 int getloadavg(double *list, int nelem);
 #endif
index 156809003f72321c395d7abcdc721b1bd3ac978e..ff123713e048feef3f7d5bf91f062b457e149461 100644 (file)
@@ -386,3 +386,16 @@ uint64_t htonll(uint64_t host64)
 }
 #endif
 
+#ifndef HAVE_FFSLL
+int ffsll(long long n)
+{
+       int i;
+       for (i = 0; i < 64; i++) {
+               if ((1LL << i) & n) {
+                       return i + 1;
+               }
+       }
+       return 0;
+}
+#endif
+