* lib/count-leading-zeros.c: New file.
* lib/count-leading-zeros.h (COUNT_LEADING_ZEROS_INLINE):
New macro. Replace all uses of 'static inline' with it.
Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
* m4/count-leading-zeros.m4 (gl_COUNT_LEADING_ZEROS):
Do not require AC_C_INLINE.
* modules/count-leading-zeros (Files, lib_SOURCES):
Add lib/count-leading-zeros.c.
(Depends-on): Add extern-inline.
2012-11-29 Paul Eggert <eggert@cs.ucla.edu>
+ count-leading-zeros: better 'inline'
+ * lib/count-leading-zeros.c: New file.
+ * lib/count-leading-zeros.h (COUNT_LEADING_ZEROS_INLINE):
+ New macro. Replace all uses of 'static inline' with it.
+ Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+ * m4/count-leading-zeros.m4 (gl_COUNT_LEADING_ZEROS):
+ Do not require AC_C_INLINE.
+ * modules/count-leading-zeros (Files, lib_SOURCES):
+ Add lib/count-leading-zeros.c.
+ (Depends-on): Add extern-inline.
+
bitrotate: better 'inline'
* lib/bitrotate.c: New file.
* lib/bitrotate.h (BITROTATE_INLINE):
--- /dev/null
+#include <config.h>
+#define COUNT_LEADING_ZEROS_INLINE _GL_EXTERN_INLINE
+#include "count-leading-zeros.h"
#include <stdlib.h>
#include "verify.h"
+_GL_INLINE_HEADER_BEGIN
+#ifndef COUNT_LEADING_ZEROS_INLINE
+# define COUNT_LEADING_ZEROS_INLINE _GL_INLINE
+#endif
+
/* Expand the code which computes the number of leading zeros of the local
variable 'x' of type TYPE (an unsigned integer type) and returns it
from the current function. */
/* Compute and return the number of leading zeros in the least
significant 32 bits of X. */
-static inline int
+COUNT_LEADING_ZEROS_INLINE int
count_leading_zeros_32 (unsigned int x)
{
/* http://graphics.stanford.edu/~seander/bithacks.html */
#endif
/* Compute and return the number of leading zeros in X. */
-static inline int
+COUNT_LEADING_ZEROS_INLINE int
count_leading_zeros (unsigned int x)
{
COUNT_LEADING_ZEROS (__builtin_clz, unsigned int);
}
/* Compute and return the number of leading zeros in X. */
-static inline int
+COUNT_LEADING_ZEROS_INLINE int
count_leading_zeros_l (unsigned long int x)
{
COUNT_LEADING_ZEROS (__builtin_clzl, unsigned long int);
#if HAVE_UNSIGNED_LONG_LONG_INT
/* Compute and return the number of leading zeros in X. */
-static inline int
+COUNT_LEADING_ZEROS_INLINE int
count_leading_zeros_ll (unsigned long long int x)
{
COUNT_LEADING_ZEROS (__builtin_clzll, unsigned long long int);
}
#endif
+_GL_INLINE_HEADER_END
+
#endif /* COUNT_LEADING_ZEROS_H */
-# count-leading-zeros.m4 serial 1
+# count-leading-zeros.m4 serial 2
dnl Copyright (C) 2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl We don't need (and can't compile) count_leading_zeros_ll
dnl unless the type 'unsigned long long int' exists.
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
-
- dnl Prerequisites of lib/count-leading-zeros.h.
- AC_REQUIRE([AC_C_INLINE])
])
Counts the number of leading 0-bits in a word.
Files:
+lib/count-leading-zeros.c
lib/count-leading-zeros.h
m4/count-leading-zeros.m4
Depends-on:
+extern-inline
verify
configure.ac:
gl_COUNT_LEADING_ZEROS
Makefile.am:
+lib_SOURCES += count-leading-zeros.c
Include:
"count-leading-zeros.h"