Commit 4069d425 authored by Bruno Haible's avatar Bruno Haible
Browse files

count-one-bits: Assume that the compiler supports 'long long'.

* lib/count-one-bits.h (count_one_bits_ll): Define unconditionally.
* m4/count-one-bits.m4: Remove file.
* modules/count-one-bits (Files): Remove it.
(configure.ac): Don't invoke gl_COUNT_ONE_BITS.
* tests/test-count-one-bits.c (main): Test count_one_bits_ll
unconditionally.
parent 00b4820c
2019-12-22 Bruno Haible <bruno@clisp.org>
 
count-one-bits: Assume that the compiler supports 'long long'.
* lib/count-one-bits.h (count_one_bits_ll): Define unconditionally.
* m4/count-one-bits.m4: Remove file.
* modules/count-one-bits (Files): Remove it.
(configure.ac): Don't invoke gl_COUNT_ONE_BITS.
* tests/test-count-one-bits.c (main): Test count_one_bits_ll
unconditionally.
count-trailing-zeros: Assume that the compiler supports 'long long'.
* lib/count-trailing-zeros.h (count_trailing_zeros_ll): Define
unconditionally.
......@@ -122,14 +122,12 @@ count_one_bits_l (unsigned long int x)
COUNT_ONE_BITS (__builtin_popcountl, __popcnt, unsigned long int);
}
#if HAVE_UNSIGNED_LONG_LONG_INT
/* Compute and return the number of 1-bits set in X. */
COUNT_ONE_BITS_INLINE int
count_one_bits_ll (unsigned long long int x)
{
COUNT_ONE_BITS (__builtin_popcountll, __popcnt64, unsigned long long int);
}
#endif
_GL_INLINE_HEADER_END
......
# count-one-bits.m4 serial 3
dnl Copyright (C) 2007, 2009-2019 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 with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_COUNT_ONE_BITS],
[
dnl We don't need (and can't compile) count_one_bits_ll
dnl unless the type 'unsigned long long int' exists.
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
])
......@@ -4,13 +4,11 @@ Counts the number of 1-bits in a word.
Files:
lib/count-one-bits.c
lib/count-one-bits.h
m4/count-one-bits.m4
Depends-on:
extern-inline
configure.ac:
gl_COUNT_ONE_BITS
Makefile.am:
lib_SOURCES += count-one-bits.c
......
......@@ -66,10 +66,8 @@ main (int argc, char *argv[])
TEST_COUNT_ONE_BITS (count_one_bits, unsigned int, UINT_BIT, UINT_MAX, 1U);
TEST_COUNT_ONE_BITS (count_one_bits_l, unsigned long int,
ULONG_BIT, ULONG_MAX, 1UL);
#ifdef HAVE_UNSIGNED_LONG_LONG_INT
TEST_COUNT_ONE_BITS (count_one_bits_ll,
unsigned long long int, ULLONG_BIT, ULLONG_MAX, 1ULL);
#endif
TEST_COUNT_ONE_BITS (count_one_bits_ll, unsigned long long int,
ULLONG_BIT, ULLONG_MAX, 1ULL);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment