]> Savannah Git Hosting - gnulib.git/commitdiff
stdbit-h, stdc_*: New modules, part of the stdbit module.
authorBruno Haible <bruno@clisp.org>
Wed, 15 May 2024 22:45:15 +0000 (00:45 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 15 May 2024 22:54:26 +0000 (00:54 +0200)
* lib/stdbit.in.h (_GL_STDC_*_INLINE): New macros.
Enclose function definitions in #if @GL_STDC_*@ conditionals.
* lib/stdc_leading_zeros.c: New file.
* lib/stdc_leading_ones.c: New file.
* lib/stdc_trailing_zeros.c: New file.
* lib/stdc_trailing_ones.c: New file.
* lib/stdc_first_leading_zero.c: New file.
* lib/stdc_first_leading_one.c: New file.
* lib/stdc_first_trailing_zero.c: New file.
* lib/stdc_first_trailing_one.c: New file.
* lib/stdc_count_zeros.c: New file.
* lib/stdc_count_ones.c: New file, based on lib/stdbit.c.
* lib/stdc_has_single_bit.c: New file.
* lib/stdc_bit_width.c: New file.
* lib/stdc_bit_floor.c: New file.
* lib/stdc_bit_ceil.c: New file.
* lib/stdbit.c (__gl_stdbit_popcount_support): Remove variable.
* m4/stdbit_h.m4 (gl_STDBIT_H): Initialize GL_STDC_* variables.
* modules/stdbit-h: New file, based on modules/stdbit.
(Depends-on): Add gen-header.
(Makefile.am): Substitute GL_STDC_* variables.
* modules/stdc_leading_zeros: New file.
* modules/stdc_leading_ones: New file.
* modules/stdc_trailing_zeros: New file.
* modules/stdc_trailing_ones: New file.
* modules/stdc_first_leading_zero: New file.
* modules/stdc_first_leading_one: New file.
* modules/stdc_first_trailing_zero: New file.
* modules/stdc_first_trailing_one: New file.
* modules/stdc_count_zeros: New file.
* modules/stdc_count_ones: New file.
* modules/stdc_has_single_bit: New file.
* modules/stdc_bit_width: New file.
* modules/stdc_bit_floor: New file.
* modules/stdc_bit_ceil: New file.
* modules/stdbit: Change to a pure composition module.
* modules/stdc_leading_zeros-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_leading_ones-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_trailing_zeros-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_trailing_ones-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_leading_zero-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_leading_one-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_trailing_zero-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_trailing_one-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_count_zeros-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_count_ones-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_has_single_bit-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_bit_width-tests: New file, based on modules/stdbit-tests.
* modules/stdc_bit_floor-tests: New file, based on modules/stdbit-tests.
* modules/stdc_bit_ceil-tests: New file, based on modules/stdbit-tests.
* modules/stdbit-tests: Remove file.
* doc/posix-functions/stdc_leading_zeros.texi: Update.
* doc/posix-functions/stdc_leading_ones.texi: Likewise.
* doc/posix-functions/stdc_trailing_zeros.texi: Likewise.
* doc/posix-functions/stdc_trailing_ones.texi: Likewise.
* doc/posix-functions/stdc_first_leading_zero.texi: Likewise.
* doc/posix-functions/stdc_first_leading_one.texi: Likewise.
* doc/posix-functions/stdc_first_trailing_zero.texi: Likewise.
* doc/posix-functions/stdc_first_trailing_one.texi: Likewise.
* doc/posix-functions/stdc_count_zeros.texi: Likewise.
* doc/posix-functions/stdc_count_ones.texi: Likewise.
* doc/posix-functions/stdc_has_single_bit.texi: Likewise.
* doc/posix-functions/stdc_bit_width.texi: Likewise.
* doc/posix-functions/stdc_bit_floor.texi: Likewise.
* doc/posix-functions/stdc_bit_ceil.texi: Likewise.

63 files changed:
ChangeLog
doc/posix-functions/stdc_bit_ceil.texi
doc/posix-functions/stdc_bit_floor.texi
doc/posix-functions/stdc_bit_width.texi
doc/posix-functions/stdc_count_ones.texi
doc/posix-functions/stdc_count_zeros.texi
doc/posix-functions/stdc_first_leading_one.texi
doc/posix-functions/stdc_first_leading_zero.texi
doc/posix-functions/stdc_first_trailing_one.texi
doc/posix-functions/stdc_first_trailing_zero.texi
doc/posix-functions/stdc_has_single_bit.texi
doc/posix-functions/stdc_leading_ones.texi
doc/posix-functions/stdc_leading_zeros.texi
doc/posix-functions/stdc_trailing_ones.texi
doc/posix-functions/stdc_trailing_zeros.texi
lib/stdbit.c
lib/stdbit.in.h
lib/stdc_bit_ceil.c [new file with mode: 0644]
lib/stdc_bit_floor.c [new file with mode: 0644]
lib/stdc_bit_width.c [new file with mode: 0644]
lib/stdc_count_ones.c [new file with mode: 0644]
lib/stdc_count_zeros.c [new file with mode: 0644]
lib/stdc_first_leading_one.c [new file with mode: 0644]
lib/stdc_first_leading_zero.c [new file with mode: 0644]
lib/stdc_first_trailing_one.c [new file with mode: 0644]
lib/stdc_first_trailing_zero.c [new file with mode: 0644]
lib/stdc_has_single_bit.c [new file with mode: 0644]
lib/stdc_leading_ones.c [new file with mode: 0644]
lib/stdc_leading_zeros.c [new file with mode: 0644]
lib/stdc_trailing_ones.c [new file with mode: 0644]
lib/stdc_trailing_zeros.c [new file with mode: 0644]
m4/stdbit_h.m4
modules/stdbit
modules/stdbit-h [new file with mode: 0644]
modules/stdbit-tests [deleted file]
modules/stdc_bit_ceil [new file with mode: 0644]
modules/stdc_bit_ceil-tests [new file with mode: 0644]
modules/stdc_bit_floor [new file with mode: 0644]
modules/stdc_bit_floor-tests [new file with mode: 0644]
modules/stdc_bit_width [new file with mode: 0644]
modules/stdc_bit_width-tests [new file with mode: 0644]
modules/stdc_count_ones [new file with mode: 0644]
modules/stdc_count_ones-tests [new file with mode: 0644]
modules/stdc_count_zeros [new file with mode: 0644]
modules/stdc_count_zeros-tests [new file with mode: 0644]
modules/stdc_first_leading_one [new file with mode: 0644]
modules/stdc_first_leading_one-tests [new file with mode: 0644]
modules/stdc_first_leading_zero [new file with mode: 0644]
modules/stdc_first_leading_zero-tests [new file with mode: 0644]
modules/stdc_first_trailing_one [new file with mode: 0644]
modules/stdc_first_trailing_one-tests [new file with mode: 0644]
modules/stdc_first_trailing_zero [new file with mode: 0644]
modules/stdc_first_trailing_zero-tests [new file with mode: 0644]
modules/stdc_has_single_bit [new file with mode: 0644]
modules/stdc_has_single_bit-tests [new file with mode: 0644]
modules/stdc_leading_ones [new file with mode: 0644]
modules/stdc_leading_ones-tests [new file with mode: 0644]
modules/stdc_leading_zeros [new file with mode: 0644]
modules/stdc_leading_zeros-tests [new file with mode: 0644]
modules/stdc_trailing_ones [new file with mode: 0644]
modules/stdc_trailing_ones-tests [new file with mode: 0644]
modules/stdc_trailing_zeros [new file with mode: 0644]
modules/stdc_trailing_zeros-tests [new file with mode: 0644]

index 049f27b3b8e74e354d0479e48762828f6f45ae02..377dbe99bbec7b67d440109f0073ade3980834dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,83 @@
+2024-05-15  Bruno Haible  <bruno@clisp.org>
+
+       stdbit-h, stdc_*: New modules, part of the stdbit module.
+       * lib/stdbit.in.h (_GL_STDC_*_INLINE): New macros.
+       Enclose function definitions in #if @GL_STDC_*@ conditionals.
+       * lib/stdc_leading_zeros.c: New file.
+       * lib/stdc_leading_ones.c: New file.
+       * lib/stdc_trailing_zeros.c: New file.
+       * lib/stdc_trailing_ones.c: New file.
+       * lib/stdc_first_leading_zero.c: New file.
+       * lib/stdc_first_leading_one.c: New file.
+       * lib/stdc_first_trailing_zero.c: New file.
+       * lib/stdc_first_trailing_one.c: New file.
+       * lib/stdc_count_zeros.c: New file.
+       * lib/stdc_count_ones.c: New file, based on lib/stdbit.c.
+       * lib/stdc_has_single_bit.c: New file.
+       * lib/stdc_bit_width.c: New file.
+       * lib/stdc_bit_floor.c: New file.
+       * lib/stdc_bit_ceil.c: New file.
+       * lib/stdbit.c (__gl_stdbit_popcount_support): Remove variable.
+       * m4/stdbit_h.m4 (gl_STDBIT_H): Initialize GL_STDC_* variables.
+       * modules/stdbit-h: New file, based on modules/stdbit.
+       (Depends-on): Add gen-header.
+       (Makefile.am): Substitute GL_STDC_* variables.
+       * modules/stdc_leading_zeros: New file.
+       * modules/stdc_leading_ones: New file.
+       * modules/stdc_trailing_zeros: New file.
+       * modules/stdc_trailing_ones: New file.
+       * modules/stdc_first_leading_zero: New file.
+       * modules/stdc_first_leading_one: New file.
+       * modules/stdc_first_trailing_zero: New file.
+       * modules/stdc_first_trailing_one: New file.
+       * modules/stdc_count_zeros: New file.
+       * modules/stdc_count_ones: New file.
+       * modules/stdc_has_single_bit: New file.
+       * modules/stdc_bit_width: New file.
+       * modules/stdc_bit_floor: New file.
+       * modules/stdc_bit_ceil: New file.
+       * modules/stdbit: Change to a pure composition module.
+       * modules/stdc_leading_zeros-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_leading_ones-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_trailing_zeros-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_trailing_ones-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_first_leading_zero-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_first_leading_one-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_first_trailing_zero-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_first_trailing_one-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_count_zeros-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_count_ones-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_has_single_bit-tests: New file, based on
+       modules/stdbit-tests.
+       * modules/stdc_bit_width-tests: New file, based on modules/stdbit-tests.
+       * modules/stdc_bit_floor-tests: New file, based on modules/stdbit-tests.
+       * modules/stdc_bit_ceil-tests: New file, based on modules/stdbit-tests.
+       * modules/stdbit-tests: Remove file.
+       * doc/posix-functions/stdc_leading_zeros.texi: Update.
+       * doc/posix-functions/stdc_leading_ones.texi: Likewise.
+       * doc/posix-functions/stdc_trailing_zeros.texi: Likewise.
+       * doc/posix-functions/stdc_trailing_ones.texi: Likewise.
+       * doc/posix-functions/stdc_first_leading_zero.texi: Likewise.
+       * doc/posix-functions/stdc_first_leading_one.texi: Likewise.
+       * doc/posix-functions/stdc_first_trailing_zero.texi: Likewise.
+       * doc/posix-functions/stdc_first_trailing_one.texi: Likewise.
+       * doc/posix-functions/stdc_count_zeros.texi: Likewise.
+       * doc/posix-functions/stdc_count_ones.texi: Likewise.
+       * doc/posix-functions/stdc_has_single_bit.texi: Likewise.
+       * doc/posix-functions/stdc_bit_width.texi: Likewise.
+       * doc/posix-functions/stdc_bit_floor.texi: Likewise.
+       * doc/posix-functions/stdc_bit_ceil.texi: Likewise.
+
 2024-05-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        stdbit: tweak first_leading for GCC
index 5b636e6b02286d5278f3692ef1d782b8cbb47c3c..31549dbd963177e8076521ddc41e8089b60b4023 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.16.
 
-Gnulib module: stdbit
+Gnulib module: stdc_bit_ceil
 
 Portability problems fixed by Gnulib:
 @itemize
index 2600aa7b9a881cb1aed8300051546dc6a7ee763b..0b811c99eb8b495000f5932839dab49099d4893c 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.15.
 
-Gnulib module: stdbit
+Gnulib module: stdc_bit_floor
 
 Portability problems fixed by Gnulib:
 @itemize
index d0bcb359f0a5c6fdd5bc652971c31eea78948fb4..c2cbf083a510b85ea8089113e4b71436c541c51f 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.14.
 
-Gnulib module: stdbit
+Gnulib module: stdc_bit_width
 
 Portability problems fixed by Gnulib:
 @itemize
index 17a0e520d8ee0fd3374b55160a0dbbbb50b57be3..2f1f292d1b8c5c903549b782006f7c9a51f39ba1 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.12.
 
-Gnulib module: stdbit
+Gnulib module: stdc_count_ones
 
 Portability problems fixed by Gnulib:
 @itemize
index 18867146e446f9939750037ba26249e868214568..0f646292c704ae715c3d4e023c0a348644ccab47 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.11.
 
-Gnulib module: stdbit
+Gnulib module: stdc_count_zeros
 
 Portability problems fixed by Gnulib:
 @itemize
index f82cb2f9409a4286369175d0b0fa38af0edea4e0..e4f8f99b22bfb6588f495abf42b75f87bf383c69 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.8.
 
-Gnulib module: stdbit
+Gnulib module: stdc_first_leading_one
 
 Portability problems fixed by Gnulib:
 @itemize
index 7509fea9ca7c7e3f8d8d18d602381389fef6e886..a09c44e53b3bda48377d19f21881168f84f7f799 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.7.
 
-Gnulib module: stdbit
+Gnulib module: stdc_first_leading_zero
 
 Portability problems fixed by Gnulib:
 @itemize
index 8e0a4cb0b87f27dcbf4188b7dc7ba2f9c9f25bf1..54bd578c2f618eb7f6c61e1418b0c10870868784 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.10.
 
-Gnulib module: stdbit
+Gnulib module: stdc_first_trailing_one
 
 Portability problems fixed by Gnulib:
 @itemize
index ffbd80203463bb6bf26474f6d20f86d81f15a4e5..82b270ad6eff88c3b804b8359fa857eeee671018 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.9.
 
-Gnulib module: stdbit
+Gnulib module: stdc_first_trailing_zero
 
 Portability problems fixed by Gnulib:
 @itemize
index cbd57c7cb83f1abc9bb42974761a32506f6524e6..5f41766482bd183c7e0a17ee852963297682270f 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.13.
 
-Gnulib module: stdbit
+Gnulib module: stdc_has_single_bit
 
 Portability problems fixed by Gnulib:
 @itemize
index f1115a2c8e625002117026cbbebc76a67a7c1eca..49a45d536d5cc152bd60197609945a7bb52c602f 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.4.
 
-Gnulib module: stdbit
+Gnulib module: stdc_leading_ones
 
 Portability problems fixed by Gnulib:
 @itemize
index 8caed8e07ee2218840b061ad84a0e8440f29d003..256b6533a4a681f93ef90292aae1d2f9e22e5c11 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.3.
 
-Gnulib module: stdbit
+Gnulib module: stdc_leading_zeros
 
 Portability problems fixed by Gnulib:
 @itemize
index 14c36bca3ee79d3c31ca3e10a052083287260c96..a7a3fc111ffc32bf7f8fd97a625affab904b40d0 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.6.
 
-Gnulib module: stdbit
+Gnulib module: stdc_trailing_ones
 
 Portability problems fixed by Gnulib:
 @itemize
index 60c4d5906abc9926a33f35d24b177dd0325314fe..fb4ae7d778ef1f6b4c77a65f0306bf7f02ac4345 100644 (file)
@@ -7,7 +7,7 @@ ISO C23 (latest free draft
 @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf})
 section 7.18.5.
 
-Gnulib module: stdbit
+Gnulib module: stdc_trailing_zeros
 
 Portability problems fixed by Gnulib:
 @itemize
index a9f0ef5074d5bbbfc04c9be07c272eb97545d9dc..4801e74d2819f76f84278297d7df0a638fa7ff09 100644 (file)
@@ -21,7 +21,3 @@
 
 #define _GL_STDBIT_INLINE _GL_EXTERN_INLINE
 #include <stdbit.h>
-
-#if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64)
-signed char __gl_stdbit_popcount_support;
-#endif
index ab328a7793df94b8e5d6e845156a69d4a5aafd21..73b234791def27e772fca8b84586707127905d66 100644 (file)
 #endif
 
 _GL_INLINE_HEADER_BEGIN
+
 #ifndef _GL_STDBIT_INLINE
 # define _GL_STDBIT_INLINE _GL_INLINE
 #endif
+#ifndef _GL_STDC_LEADING_ZEROS_INLINE
+# define _GL_STDC_LEADING_ZEROS_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_LEADING_ONES_INLINE
+# define _GL_STDC_LEADING_ONES_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_TRAILING_ZEROS_INLINE
+# define _GL_STDC_TRAILING_ZEROS_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_TRAILING_ONES_INLINE
+# define _GL_STDC_TRAILING_ONES_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_FIRST_LEADING_ZERO_INLINE
+# define _GL_STDC_FIRST_LEADING_ZERO_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_FIRST_LEADING_ONE_INLINE
+# define _GL_STDC_FIRST_LEADING_ONE_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_FIRST_TRAILING_ZERO_INLINE
+# define _GL_STDC_FIRST_TRAILING_ZERO_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_FIRST_TRAILING_ONE_INLINE
+# define _GL_STDC_FIRST_TRAILING_ONE_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_COUNT_ZEROS_INLINE
+# define _GL_STDC_COUNT_ZEROS_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_COUNT_ONES_INLINE
+# define _GL_STDC_COUNT_ONES_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_HAS_SINGLE_BIT_INLINE
+# define _GL_STDC_HAS_SINGLE_BIT_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_BIT_WIDTH_INLINE
+# define _GL_STDC_BIT_WIDTH_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_BIT_FLOOR_INLINE
+# define _GL_STDC_BIT_FLOOR_INLINE _GL_INLINE
+#endif
+#ifndef _GL_STDC_BIT_CEIL_INLINE
+# define _GL_STDC_BIT_CEIL_INLINE _GL_INLINE
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -49,8 +92,14 @@ extern "C" {
 # define _GL_STDBIT_TYPEOF_CAST(a, b) (b)
 #endif
 
+
+/* ISO C 23 § 7.18.1 General  */
+
 #define __STDC_VERSION_STDBIT_H__ 202311L
 
+
+/* ISO C 23 § 7.18.2 Endian  */
+
 #define __STDC_ENDIAN_BIG__ 4321
 #define __STDC_ENDIAN_LITTLE__ 1234
 #ifdef WORDS_BIGENDIAN
@@ -59,6 +108,7 @@ extern "C" {
 # define __STDC_ENDIAN_NATIVE__ __STDC_ENDIAN_LITTLE__
 #endif
 
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -223,13 +273,14 @@ __gl_stdbit_ctzll (unsigned long long int n)
 }
 #endif
 
+#if @GL_STDC_COUNT_ONES@
 /* Count 1 bits in N.  */
-#ifdef _GL_STDBIT_HAS_BUILTIN_POPCOUNT
-# define __gl_stdbit_popcount __builtin_popcount
-# define __gl_stdbit_popcountl __builtin_popcountl
-# define __gl_stdbit_popcountll __builtin_popcountll
-#else
-_GL_STDBIT_INLINE int
+# ifdef _GL_STDBIT_HAS_BUILTIN_POPCOUNT
+#  define __gl_stdbit_popcount __builtin_popcount
+#  define __gl_stdbit_popcountl __builtin_popcountl
+#  define __gl_stdbit_popcountll __builtin_popcountll
+# else
+_GL_STDC_COUNT_ONES_INLINE int
 __gl_stdbit_popcount_wide (unsigned long long int n)
 {
   if (sizeof n & (sizeof n - 1))
@@ -276,25 +327,25 @@ __gl_stdbit_popcount_wide (unsigned long long int n)
     }
 }
 
-# ifdef _MSC_VER
-#  if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64)
-#   pragma intrinsic (__cpuid)
-#   pragma intrinsic (__popcnt)
-#   ifdef _M_X64
-#    pragma intrinsic (__popcnt64)
-#   else
-_GL_STDBIT_INLINE int
+#  ifdef _MSC_VER
+#   if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64)
+#    pragma intrinsic (__cpuid)
+#    pragma intrinsic (__popcnt)
+#    ifdef _M_X64
+#     pragma intrinsic (__popcnt64)
+#    else
+_GL_STDC_COUNT_ONES_INLINE int
 __popcnt64 (unsigned long long int n)
 {
   return __popcnt (n >> 32) + __popcnt (n);
 }
+#    endif
 #   endif
-#  endif
 
 /* 1 if supported, -1 if not, 0 if unknown.  */
 extern signed char __gl_stdbit_popcount_support;
 
-_GL_STDBIT_INLINE bool
+_GL_STDC_COUNT_ONES_INLINE bool
 __gl_stdbit_popcount_supported (void)
 {
   if (!__gl_stdbit_popcount_support)
@@ -309,188 +360,217 @@ __gl_stdbit_popcount_supported (void)
     }
   return 0 < __gl_stdbit_popcount_support;
 }
-_GL_STDBIT_INLINE int
+_GL_STDC_COUNT_ONES_INLINE int
 __gl_stdbit_popcount (unsigned int n)
 {
   return (__gl_stdbit_popcount_supported ()
           ? __popcnt (n)
           : __gl_stdbit_popcount_wide (n));
 }
-_GL_STDBIT_INLINE int
+_GL_STDC_COUNT_ONES_INLINE int
 __gl_stdbit_popcountl (unsigned long int n)
 {
   return (__gl_stdbit_popcount_supported ()
           ? __popcnt (n)
           : __gl_stdbit_popcount_wide (n));
 }
-_GL_STDBIT_INLINE int
+_GL_STDC_COUNT_ONES_INLINE int
 __gl_stdbit_popcountll (unsigned long long int n)
 {
   return (__gl_stdbit_popcount_supported ()
           ? __popcnt64 (n)
           : __gl_stdbit_popcount_wide (n));
 }
-# else /* !_MSC_VER */
-#  define __gl_stdbit_popcount __gl_stdbit_popcount_wide
-#  define __gl_stdbit_popcountl __gl_stdbit_popcount_wide
-#  define __gl_stdbit_popcountll __gl_stdbit_popcount_wide
+#  else /* !_MSC_VER */
+#   define __gl_stdbit_popcount __gl_stdbit_popcount_wide
+#   define __gl_stdbit_popcountl __gl_stdbit_popcount_wide
+#   define __gl_stdbit_popcountll __gl_stdbit_popcount_wide
+#  endif
 # endif
 #endif
 
 
-_GL_STDBIT_INLINE unsigned int
+/* ISO C 23 § 7.18.3 Count Leading Zeros  */
+
+#if @GL_STDC_LEADING_ZEROS@
+
+_GL_STDC_LEADING_ZEROS_INLINE unsigned int
 stdc_leading_zeros_ui (unsigned int n)
 {
   return __gl_stdbit_clz (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ZEROS_INLINE unsigned int
 stdc_leading_zeros_uc (unsigned char n)
 {
   return stdc_leading_zeros_ui (n) - 8 * (sizeof 0u - sizeof n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ZEROS_INLINE unsigned int
 stdc_leading_zeros_us (unsigned short int n)
 {
   return stdc_leading_zeros_ui (n) - 8 * (sizeof 0u - sizeof n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ZEROS_INLINE unsigned int
 stdc_leading_zeros_ul (unsigned long int n)
 {
   return __gl_stdbit_clzl (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ZEROS_INLINE unsigned int
 stdc_leading_zeros_ull (unsigned long long int n)
 {
   return __gl_stdbit_clzll (n);
 }
 
-#define stdc_leading_zeros(n) \
+# define stdc_leading_zeros(n) \
   (sizeof (n) == 1 ? stdc_leading_zeros_uc (n) \
    : sizeof (n) == sizeof (unsigned short int) ? stdc_leading_zeros_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_leading_zeros_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_leading_zeros_ul (n) \
    : stdc_leading_zeros_ull (n))
 
+#endif
+
 
-_GL_STDBIT_INLINE unsigned int
+/* ISO C 23 § 7.18.4 Count Leading Ones  */
+
+#if @GL_STDC_LEADING_ONES@
+
+_GL_STDC_LEADING_ONES_INLINE unsigned int
 stdc_leading_ones_uc (unsigned char n)
 {
   return stdc_leading_zeros_uc (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ONES_INLINE unsigned int
 stdc_leading_ones_us (unsigned short int n)
 {
   return stdc_leading_zeros_us (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ONES_INLINE unsigned int
 stdc_leading_ones_ui (unsigned int n)
 {
   return stdc_leading_zeros_ui (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ONES_INLINE unsigned int
 stdc_leading_ones_ul (unsigned long int n)
 {
   return stdc_leading_zeros_ul (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_LEADING_ONES_INLINE unsigned int
 stdc_leading_ones_ull (unsigned long long int n)
 {
   return stdc_leading_zeros_ull (~n);
 }
 
-#define stdc_leading_ones(n) \
+# define stdc_leading_ones(n) \
   (sizeof (n) == 1 ? stdc_leading_ones_uc (n)  \
    : sizeof (n) == sizeof (unsigned short int) ? stdc_leading_ones_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_leading_ones_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_leading_ones_ul (n) \
    : stdc_leading_ones_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.5 Count Trailing Zeros  */
 
-_GL_STDBIT_INLINE unsigned int
+#if @GL_STDC_TRAILING_ZEROS@
+
+_GL_STDC_TRAILING_ZEROS_INLINE unsigned int
 stdc_trailing_zeros_ui (unsigned int n)
 {
   return __gl_stdbit_ctz (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ZEROS_INLINE unsigned int
 stdc_trailing_zeros_uc (unsigned char n)
 {
   return stdc_trailing_zeros_ui (n | (1 + (unsigned char) -1));
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ZEROS_INLINE unsigned int
 stdc_trailing_zeros_us (unsigned short int n)
 {
   return stdc_trailing_zeros_ui (n | (1 + (unsigned short int) -1));
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ZEROS_INLINE unsigned int
 stdc_trailing_zeros_ul (unsigned long int n)
 {
   return __gl_stdbit_ctzl (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ZEROS_INLINE unsigned int
 stdc_trailing_zeros_ull (unsigned long long int n)
 {
   return __gl_stdbit_ctzll (n);
 }
 
-#define stdc_trailing_zeros(n) \
+# define stdc_trailing_zeros(n) \
   (sizeof (n) == 1 ? stdc_trailing_zeros_uc (n)        \
    : sizeof (n) == sizeof (unsigned short int) ? stdc_trailing_zeros_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_trailing_zeros_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_trailing_zeros_ul (n) \
    : stdc_trailing_zeros_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.6 Count Trailing Ones  */
+
+#if @GL_STDC_TRAILING_ONES@
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ONES_INLINE unsigned int
 stdc_trailing_ones_uc (unsigned char n)
 {
   return stdc_trailing_zeros_uc (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ONES_INLINE unsigned int
 stdc_trailing_ones_us (unsigned short int n)
 {
   return stdc_trailing_zeros_us (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ONES_INLINE unsigned int
 stdc_trailing_ones_ui (unsigned int n)
 {
   return stdc_trailing_zeros_ui (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ONES_INLINE unsigned int
 stdc_trailing_ones_ul (unsigned long int n)
 {
   return stdc_trailing_zeros_ul (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_TRAILING_ONES_INLINE unsigned int
 stdc_trailing_ones_ull (unsigned long long int n)
 {
   return stdc_trailing_zeros_ull (~n);
 }
 
-#define stdc_trailing_ones(n) \
+# define stdc_trailing_ones(n) \
   (sizeof (n) == 1 ? stdc_trailing_ones_uc (n) \
    : sizeof (n) == sizeof (unsigned short int) ? stdc_trailing_ones_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_trailing_ones_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_trailing_ones_ul (n) \
    : stdc_trailing_ones_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.7 First Leading Zero  */
 
-_GL_STDBIT_INLINE unsigned int
+#if @GL_STDC_FIRST_LEADING_ZERO@
+
+_GL_STDC_FIRST_LEADING_ZERO_INLINE unsigned int
 stdc_first_leading_zero_uc (unsigned char n)
 {
   unsigned int count = stdc_leading_ones_uc (n);
@@ -498,7 +578,7 @@ stdc_first_leading_zero_uc (unsigned char n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ZERO_INLINE unsigned int
 stdc_first_leading_zero_us (unsigned short int n)
 {
   unsigned int count = stdc_leading_ones_us (n);
@@ -506,7 +586,7 @@ stdc_first_leading_zero_us (unsigned short int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ZERO_INLINE unsigned int
 stdc_first_leading_zero_ui (unsigned int n)
 {
   unsigned int count = stdc_leading_ones_ui (n);
@@ -514,7 +594,7 @@ stdc_first_leading_zero_ui (unsigned int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ZERO_INLINE unsigned int
 stdc_first_leading_zero_ul (unsigned long int n)
 {
   unsigned int count = stdc_leading_ones_ul (n);
@@ -522,7 +602,7 @@ stdc_first_leading_zero_ul (unsigned long int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ZERO_INLINE unsigned int
 stdc_first_leading_zero_ull (unsigned long long int n)
 {
   unsigned int count = stdc_leading_ones_ull (n);
@@ -530,15 +610,21 @@ stdc_first_leading_zero_ull (unsigned long long int n)
   return count % bits + (count < bits);
 }
 
-#define stdc_first_leading_zero(n) \
+# define stdc_first_leading_zero(n) \
   (sizeof (n) == 1 ? stdc_first_leading_zero_uc (n) \
    : sizeof (n) == sizeof (unsigned short) ? stdc_first_leading_zero_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_first_leading_zero_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_first_leading_zero_ul (n) \
    : stdc_first_leading_zero_ull (n))
 
+#endif
+
 
-_GL_STDBIT_INLINE unsigned int
+/* ISO C 23 § 7.18.8 First Leading One  */
+
+#if @GL_STDC_FIRST_LEADING_ONE@
+
+_GL_STDC_FIRST_LEADING_ONE_INLINE unsigned int
 stdc_first_leading_one_uc (unsigned char n)
 {
   unsigned int count = stdc_leading_zeros_uc (n);
@@ -546,7 +632,7 @@ stdc_first_leading_one_uc (unsigned char n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ONE_INLINE unsigned int
 stdc_first_leading_one_us (unsigned short int n)
 {
   unsigned int count = stdc_leading_zeros_us (n);
@@ -554,7 +640,7 @@ stdc_first_leading_one_us (unsigned short int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ONE_INLINE unsigned int
 stdc_first_leading_one_ui (unsigned int n)
 {
   unsigned int count = stdc_leading_zeros_ui (n);
@@ -562,7 +648,7 @@ stdc_first_leading_one_ui (unsigned int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ONE_INLINE unsigned int
 stdc_first_leading_one_ul (unsigned long int n)
 {
   unsigned int count = stdc_leading_zeros_ul (n);
@@ -570,7 +656,7 @@ stdc_first_leading_one_ul (unsigned long int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_LEADING_ONE_INLINE unsigned int
 stdc_first_leading_one_ull (unsigned long long int n)
 {
   unsigned int count = stdc_leading_zeros_ull (n);
@@ -578,15 +664,21 @@ stdc_first_leading_one_ull (unsigned long long int n)
   return count % bits + (count < bits);
 }
 
-#define stdc_first_leading_one(n) \
+# define stdc_first_leading_one(n) \
   (sizeof (n) == 1 ? stdc_first_leading_one_uc (n) \
    : sizeof (n) == sizeof (unsigned short) ? stdc_first_leading_one_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_first_leading_one_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_first_leading_one_ul (n) \
    : stdc_first_leading_one_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.9 First Trailing Zero  */
 
-_GL_STDBIT_INLINE unsigned int
+#if @GL_STDC_FIRST_TRAILING_ZERO@
+
+_GL_STDC_FIRST_TRAILING_ZERO_INLINE unsigned int
 stdc_first_trailing_zero_uc (unsigned char n)
 {
   unsigned int count = stdc_trailing_ones_uc (n);
@@ -594,7 +686,7 @@ stdc_first_trailing_zero_uc (unsigned char n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ZERO_INLINE unsigned int
 stdc_first_trailing_zero_us (unsigned short int n)
 {
   unsigned int count = stdc_trailing_ones_us (n);
@@ -602,7 +694,7 @@ stdc_first_trailing_zero_us (unsigned short int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ZERO_INLINE unsigned int
 stdc_first_trailing_zero_ui (unsigned int n)
 {
   unsigned int count = stdc_trailing_ones_ui (n);
@@ -610,7 +702,7 @@ stdc_first_trailing_zero_ui (unsigned int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ZERO_INLINE unsigned int
 stdc_first_trailing_zero_ul (unsigned long int n)
 {
   unsigned int count = stdc_trailing_ones_ul (n);
@@ -618,7 +710,7 @@ stdc_first_trailing_zero_ul (unsigned long int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ZERO_INLINE unsigned int
 stdc_first_trailing_zero_ull (unsigned long long int n)
 {
   unsigned int count = stdc_trailing_ones_ull (n);
@@ -626,15 +718,21 @@ stdc_first_trailing_zero_ull (unsigned long long int n)
   return count % bits + (count < bits);
 }
 
-#define stdc_first_trailing_zero(n) \
+# define stdc_first_trailing_zero(n) \
   (sizeof (n) == 1 ? stdc_first_trailing_zero_uc (n) \
    : sizeof (n) == sizeof (unsigned short) ? stdc_first_trailing_zero_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_first_trailing_zero_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_first_trailing_zero_ul (n) \
    : stdc_first_trailing_zero_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.10 First Trailing One  */
+
+#if @GL_STDC_FIRST_TRAILING_ONE@
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ONE_INLINE unsigned int
 stdc_first_trailing_one_uc (unsigned char n)
 {
   unsigned int count = stdc_trailing_zeros_uc (n);
@@ -642,7 +740,7 @@ stdc_first_trailing_one_uc (unsigned char n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ONE_INLINE unsigned int
 stdc_first_trailing_one_us (unsigned short int n)
 {
   unsigned int count = stdc_trailing_zeros_us (n);
@@ -650,7 +748,7 @@ stdc_first_trailing_one_us (unsigned short int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ONE_INLINE unsigned int
 stdc_first_trailing_one_ui (unsigned int n)
 {
   unsigned int count = stdc_trailing_zeros_ui (n);
@@ -658,7 +756,7 @@ stdc_first_trailing_one_ui (unsigned int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ONE_INLINE unsigned int
 stdc_first_trailing_one_ul (unsigned long int n)
 {
   unsigned int count = stdc_trailing_zeros_ul (n);
@@ -666,7 +764,7 @@ stdc_first_trailing_one_ul (unsigned long int n)
   return count % bits + (count < bits);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_FIRST_TRAILING_ONE_INLINE unsigned int
 stdc_first_trailing_one_ull (unsigned long long int n)
 {
   unsigned int count = stdc_trailing_zeros_ull (n);
@@ -681,119 +779,137 @@ stdc_first_trailing_one_ull (unsigned long long int n)
    : sizeof (n) == sizeof 0ul ? stdc_first_trailing_one_ul (n) \
    : stdc_first_trailing_one_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.12 Count Ones  */
 
-_GL_STDBIT_INLINE unsigned int
+#if @GL_STDC_COUNT_ONES@
+
+_GL_STDC_COUNT_ONES_INLINE unsigned int
 stdc_count_ones_ui (unsigned int n)
 {
   return __gl_stdbit_popcount (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ONES_INLINE unsigned int
 stdc_count_ones_uc (unsigned char n)
 {
   return stdc_count_ones_ui (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ONES_INLINE unsigned int
 stdc_count_ones_us (unsigned short int n)
 {
   return stdc_count_ones_ui (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ONES_INLINE unsigned int
 stdc_count_ones_ul (unsigned long int n)
 {
   return __gl_stdbit_popcountl (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ONES_INLINE unsigned int
 stdc_count_ones_ull (unsigned long long int n)
 {
   return __gl_stdbit_popcountll (n);
 }
 
-#define stdc_count_ones(n) \
+# define stdc_count_ones(n) \
   (sizeof (n) == 1 ? stdc_count_ones_uc (n) \
    : sizeof (n) == sizeof (unsigned short int) ? stdc_count_ones_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_count_ones_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_count_ones_ul (n) \
    : stdc_count_ones_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.11 Count Zeros  */
+
+#if @GL_STDC_COUNT_ZEROS@
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ZEROS_INLINE unsigned int
 stdc_count_zeros_uc (unsigned char n)
 {
   return stdc_count_ones_uc (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ZEROS_INLINE unsigned int
 stdc_count_zeros_us (unsigned short int n)
 {
   return stdc_count_ones_us (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ZEROS_INLINE unsigned int
 stdc_count_zeros_ui (unsigned int n)
 {
   return stdc_count_ones_ui (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ZEROS_INLINE unsigned int
 stdc_count_zeros_ul (unsigned long int n)
 {
   return stdc_count_ones_ul (~n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_COUNT_ZEROS_INLINE unsigned int
 stdc_count_zeros_ull (unsigned long long int n)
 {
   return stdc_count_ones_ull (~n);
 }
 
-#define stdc_count_zeros(n) \
+# define stdc_count_zeros(n) \
   (sizeof (n) == 1 ? stdc_count_zeros_uc (n) \
    : sizeof (n) == sizeof (unsigned short int) ? stdc_count_zeros_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_count_zeros_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_count_zeros_ul (n) \
    : stdc_count_zeros_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.13 Single-bit Check  */
 
-_GL_STDBIT_INLINE bool
+#if @GL_STDC_HAS_SINGLE_BIT@
+
+_GL_STDC_HAS_SINGLE_BIT_INLINE bool
 stdc_has_single_bit_uc (unsigned char n)
 {
   unsigned char n_1 = n - 1, nx = n_1 ^ n;
   return n_1 < nx;
 }
 
-_GL_STDBIT_INLINE bool
+_GL_STDC_HAS_SINGLE_BIT_INLINE bool
 stdc_has_single_bit_us (unsigned short int n)
 {
   unsigned short int n_1 = n - 1, nx = n_1 ^ n;
   return n_1 < nx;
 }
 
-_GL_STDBIT_INLINE bool
+_GL_STDC_HAS_SINGLE_BIT_INLINE bool
 stdc_has_single_bit_ui (unsigned int n)
 {
   unsigned int n_1 = n - 1, nx = n_1 ^ n;
   return n_1 < nx;
 }
 
-_GL_STDBIT_INLINE bool
+_GL_STDC_HAS_SINGLE_BIT_INLINE bool
 stdc_has_single_bit_ul (unsigned long int n)
 {
   unsigned long int n_1 = n - 1, nx = n_1 ^ n;
   return n_1 < nx;
 }
 
-_GL_STDBIT_INLINE bool
+_GL_STDC_HAS_SINGLE_BIT_INLINE bool
 stdc_has_single_bit_ull (unsigned long long int n)
 {
   unsigned long long int n_1 = n - 1, nx = n_1 ^ n;
   return n_1 < nx;
 }
 
-#define stdc_has_single_bit(n) \
+# define stdc_has_single_bit(n) \
   ((bool) \
    (sizeof (n) == 1 ? stdc_has_single_bit_uc (n) \
     : sizeof (n) == sizeof (unsigned short int) ? stdc_has_single_bit_us (n) \
@@ -801,76 +917,88 @@ stdc_has_single_bit_ull (unsigned long long int n)
     : sizeof (n) == sizeof 0ul ? stdc_has_single_bit_ul (n) \
     : stdc_has_single_bit_ull (n)))
 
+#endif
+
+
+/* ISO C 23 § 7.18.14 Bit Width  */
+
+#if @GL_STDC_BIT_WIDTH@
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_BIT_WIDTH_INLINE unsigned int
 stdc_bit_width_uc (unsigned char n)
 {
   return 8 * sizeof n - stdc_leading_zeros_uc (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_BIT_WIDTH_INLINE unsigned int
 stdc_bit_width_us (unsigned short int n)
 {
   return 8 * sizeof n - stdc_leading_zeros_us (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_BIT_WIDTH_INLINE unsigned int
 stdc_bit_width_ui (unsigned int n)
 {
   return 8 * sizeof n - stdc_leading_zeros_ui (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_BIT_WIDTH_INLINE unsigned int
 stdc_bit_width_ul (unsigned long int n)
 {
   return 8 * sizeof n - stdc_leading_zeros_ul (n);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_BIT_WIDTH_INLINE unsigned int
 stdc_bit_width_ull (unsigned long long int n)
 {
   return 8 * sizeof n - stdc_leading_zeros_ull (n);
 }
 
-#define stdc_bit_width(n) \
+# define stdc_bit_width(n) \
   (sizeof (n) == 1 ? stdc_bit_width_uc (n) \
    : sizeof (n) == sizeof (unsigned short int) ? stdc_bit_width_us (n) \
    : sizeof (n) == sizeof 0u ? stdc_bit_width_ui (n) \
    : sizeof (n) == sizeof 0ul ? stdc_bit_width_ul (n) \
    : stdc_bit_width_ull (n))
 
+#endif
+
+
+/* ISO C 23 § 7.18.15 Bit Floor  */
 
-_GL_STDBIT_INLINE unsigned char
+#if @GL_STDC_BIT_FLOOR@
+
+_GL_STDC_BIT_FLOOR_INLINE unsigned char
 stdc_bit_floor_uc (unsigned char n)
 {
   return n ? 1u << (stdc_bit_width_uc (n) - 1) : 0;
 }
 
-_GL_STDBIT_INLINE unsigned short int
+_GL_STDC_BIT_FLOOR_INLINE unsigned short int
 stdc_bit_floor_us (unsigned short int n)
 {
   return n ? 1u << (stdc_bit_width_us (n) - 1) : 0;
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_BIT_FLOOR_INLINE unsigned int
 stdc_bit_floor_ui (unsigned int n)
 {
   return n ? 1u << (stdc_bit_width_ui (n) - 1) : 0;
 }
 
-_GL_STDBIT_INLINE unsigned long int
+_GL_STDC_BIT_FLOOR_INLINE unsigned long int
 stdc_bit_floor_ul (unsigned long int n)
 {
   return n ? 1ul << (stdc_bit_width_ul (n) - 1) : 0;
 }
 
-_GL_STDBIT_INLINE unsigned long long int
+_GL_STDC_BIT_FLOOR_INLINE unsigned long long int
 stdc_bit_floor_ull (unsigned long long int n)
 {
   return n ? 1ull << (stdc_bit_width_ull (n) - 1) : 0;
 }
 
-#define stdc_bit_floor(n) \
+# define stdc_bit_floor(n) \
   (_GL_STDBIT_TYPEOF_CAST \
    (n, \
     (sizeof (n) == 1 ? stdc_bit_floor_uc (n) \
@@ -879,38 +1007,44 @@ stdc_bit_floor_ull (unsigned long long int n)
      : sizeof (n) == sizeof 0ul ? stdc_bit_floor_ul (n) \
      : stdc_bit_floor_ull (n))))
 
+#endif
+
+
+/* ISO C 23 § 7.18.16 Bit Ceiling  */
+
+#if @GL_STDC_BIT_CEIL@
 
-_GL_STDBIT_INLINE unsigned char
+_GL_STDC_BIT_CEIL_INLINE unsigned char
 stdc_bit_ceil_uc (unsigned char n)
 {
   return n <= 1 ? 1 : 2u << (stdc_bit_width_uc (n - 1) - 1);
 }
 
-_GL_STDBIT_INLINE unsigned short int
+_GL_STDC_BIT_CEIL_INLINE unsigned short int
 stdc_bit_ceil_us (unsigned short int n)
 {
   return n <= 1 ? 1 : 2u << (stdc_bit_width_us (n - 1) - 1);
 }
 
-_GL_STDBIT_INLINE unsigned int
+_GL_STDC_BIT_CEIL_INLINE unsigned int
 stdc_bit_ceil_ui (unsigned int n)
 {
   return n <= 1 ? 1 : 2u << (stdc_bit_width_ui (n - 1) - 1);
 }
 
-_GL_STDBIT_INLINE unsigned long int
+_GL_STDC_BIT_CEIL_INLINE unsigned long int
 stdc_bit_ceil_ul (unsigned long int n)
 {
   return n <= 1 ? 1 : 2ul << (stdc_bit_width_ul (n - 1) - 1);
 }
 
-_GL_STDBIT_INLINE unsigned long long int
+_GL_STDC_BIT_CEIL_INLINE unsigned long long int
 stdc_bit_ceil_ull (unsigned long long int n)
 {
   return n <= 1 ? 1 : 2ull << (stdc_bit_width_ull (n - 1) - 1);
 }
 
-#define stdc_bit_ceil(n) \
+# define stdc_bit_ceil(n) \
   (_GL_STDBIT_TYPEOF_CAST \
    (n, \
     (sizeof (n) == 1 ? stdc_bit_ceil_uc (n) \
@@ -919,6 +1053,8 @@ stdc_bit_ceil_ull (unsigned long long int n)
      : sizeof (n) == sizeof 0ul ? stdc_bit_ceil_ul (n) \
      : stdc_bit_ceil_ull (n))))
 
+#endif
+
 
 #ifdef __cplusplus
 }
diff --git a/lib/stdc_bit_ceil.c b/lib/stdc_bit_ceil.c
new file mode 100644 (file)
index 0000000..4a2ddb2
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_bit_ceil_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_BIT_CEIL_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_bit_floor.c b/lib/stdc_bit_floor.c
new file mode 100644 (file)
index 0000000..27fc5b9
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_bit_floor_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_BIT_FLOOR_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_bit_width.c b/lib/stdc_bit_width.c
new file mode 100644 (file)
index 0000000..a0dc8de
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_bit_width_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_BIT_WIDTH_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_count_ones.c b/lib/stdc_count_ones.c
new file mode 100644 (file)
index 0000000..7421178
--- /dev/null
@@ -0,0 +1,24 @@
+/* stdc_count_ones_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_COUNT_ONES_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
+
+#if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64)
+signed char __gl_stdbit_popcount_support;
+#endif
diff --git a/lib/stdc_count_zeros.c b/lib/stdc_count_zeros.c
new file mode 100644 (file)
index 0000000..c164d9f
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_count_zeros_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_COUNT_ZEROS_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_first_leading_one.c b/lib/stdc_first_leading_one.c
new file mode 100644 (file)
index 0000000..9a2ab1c
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_first_leading_one_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_FIRST_LEADING_ONE_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_first_leading_zero.c b/lib/stdc_first_leading_zero.c
new file mode 100644 (file)
index 0000000..d9a18d1
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_first_leading_zero_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_FIRST_LEADING_ZERO_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_first_trailing_one.c b/lib/stdc_first_trailing_one.c
new file mode 100644 (file)
index 0000000..9162349
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_first_trailing_one_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_FIRST_TRAILING_ONE_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_first_trailing_zero.c b/lib/stdc_first_trailing_zero.c
new file mode 100644 (file)
index 0000000..a8e12a3
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_first_trailing_zero_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_FIRST_TRAILING_ZERO_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_has_single_bit.c b/lib/stdc_has_single_bit.c
new file mode 100644 (file)
index 0000000..68ef33b
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_has_single_bit_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_HAS_SINGLE_BIT_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_leading_ones.c b/lib/stdc_leading_ones.c
new file mode 100644 (file)
index 0000000..1f2e615
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_leading_ones_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_LEADING_ONES_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_leading_zeros.c b/lib/stdc_leading_zeros.c
new file mode 100644 (file)
index 0000000..45695e5
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_leading_zeros_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_LEADING_ZEROS_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_trailing_ones.c b/lib/stdc_trailing_ones.c
new file mode 100644 (file)
index 0000000..4a39cf0
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_trailing_ones_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_TRAILING_ONES_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
diff --git a/lib/stdc_trailing_zeros.c b/lib/stdc_trailing_zeros.c
new file mode 100644 (file)
index 0000000..f4bc43a
--- /dev/null
@@ -0,0 +1,20 @@
+/* stdc_trailing_zeros_* functions.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#define _GL_STDC_TRAILING_ZEROS_INLINE _GL_EXTERN_INLINE
+#include <stdbit.h>
index 3c07bdc669426d27d71f499a4fa292bf8083c4c1..6af813f39dcb0217727c751c07a42511cbd876e1 100644 (file)
@@ -1,5 +1,5 @@
 # stdbit_h.m4
-# serial 1
+# serial 2
 dnl Copyright 2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,10 +10,28 @@ dnl A placeholder for <stdbit.h>, for platforms that have issues.
 AC_DEFUN_ONCE([gl_STDBIT_H],
 [
   AC_REQUIRE([gl_BIGENDIAN])
+
   AC_CHECK_HEADERS_ONCE([stdbit.h])
   if test $ac_cv_header_stdbit_h = yes; then
     GL_GENERATE_STDBIT_H=false
   else
     GL_GENERATE_STDBIT_H=true
   fi
+
+  dnl We don't use gl_MODULE_INDICATOR_INIT_VARIABLE here, because stdbit.in.h
+  dnl does not use #include_next.
+  GL_STDC_LEADING_ZEROS=0;       AC_SUBST([GL_STDC_LEADING_ZEROS])
+  GL_STDC_LEADING_ONES=0;        AC_SUBST([GL_STDC_LEADING_ONES])
+  GL_STDC_TRAILING_ZEROS=0;      AC_SUBST([GL_STDC_TRAILING_ZEROS])
+  GL_STDC_TRAILING_ONES=0;       AC_SUBST([GL_STDC_TRAILING_ONES])
+  GL_STDC_FIRST_LEADING_ZERO=0;  AC_SUBST([GL_STDC_FIRST_LEADING_ZERO])
+  GL_STDC_FIRST_LEADING_ONE=0;   AC_SUBST([GL_STDC_FIRST_LEADING_ONE])
+  GL_STDC_FIRST_TRAILING_ZERO=0; AC_SUBST([GL_STDC_FIRST_TRAILING_ZERO])
+  GL_STDC_FIRST_TRAILING_ONE=0;  AC_SUBST([GL_STDC_FIRST_TRAILING_ONE])
+  GL_STDC_COUNT_ZEROS=0;         AC_SUBST([GL_STDC_COUNT_ZEROS])
+  GL_STDC_COUNT_ONES=0;          AC_SUBST([GL_STDC_COUNT_ONES])
+  GL_STDC_HAS_SINGLE_BIT=0;      AC_SUBST([GL_STDC_HAS_SINGLE_BIT])
+  GL_STDC_BIT_WIDTH=0;           AC_SUBST([GL_STDC_BIT_WIDTH])
+  GL_STDC_BIT_FLOOR=0;           AC_SUBST([GL_STDC_BIT_FLOOR])
+  GL_STDC_BIT_CEIL=0;            AC_SUBST([GL_STDC_BIT_CEIL])
 ])
index b4286508035fa0a512c6a1d3e8ac0d474e525926..e2ddabac5623ebd5a372cf0c5072ce16396fdace 100644 (file)
@@ -1,36 +1,28 @@
 Description:
-A stdbit.h that is like C23.
+A <stdbit.h> that is like C23.
 
 Files:
-lib/stdbit.c
-lib/stdbit.in.h
-m4/stdbit_h.m4
 
 Depends-on:
-extern-inline           [$GL_GENERATE_STDBIT_H]
-stdbool                 [$GL_GENERATE_STDBIT_H]
+stdbit-h
+stdc_leading_zeros
+stdc_leading_ones
+stdc_trailing_zeros
+stdc_trailing_ones
+stdc_first_leading_zero
+stdc_first_leading_one
+stdc_first_trailing_zero
+stdc_first_trailing_one
+stdc_count_zeros
+stdc_count_ones
+stdc_has_single_bit
+stdc_bit_width
+stdc_bit_floor
+stdc_bit_ceil
 
 configure.ac:
-gl_STDBIT_H
-gl_CONDITIONAL_HEADER([stdbit.h])
-AC_PROG_MKDIR_P
 
 Makefile.am:
-BUILT_SOURCES += $(STDBIT_H)
-
-# We need the following in order to create <stdbit.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_STDBIT_H
-stdbit.h: stdbit.in.h $(top_builddir)/config.status
-@NMD@  $(AM_V_GEN)$(MKDIR_P) '%reldir%'
-       $(gl_V_at)cp $(srcdir)/stdbit.in.h $@-t
-       $(AM_V_at)mv $@-t $@
-lib_SOURCES += stdbit.c
-else
-stdbit.h: $(top_builddir)/config.status
-       rm -f $@
-endif
-MOSTLYCLEANFILES += stdbit.h stdbit.h-t
 
 Include:
 <stdbit.h>
diff --git a/modules/stdbit-h b/modules/stdbit-h
new file mode 100644 (file)
index 0000000..ddf1770
--- /dev/null
@@ -0,0 +1,58 @@
+Description:
+A <stdbit.h> for platforms that lack it.
+
+Files:
+lib/stdbit.in.h
+lib/stdbit.c
+m4/stdbit_h.m4
+
+Depends-on:
+gen-header
+extern-inline           [$GL_GENERATE_STDBIT_H]
+stdbool                 [$GL_GENERATE_STDBIT_H]
+
+configure.ac:
+gl_STDBIT_H
+gl_CONDITIONAL_HEADER([stdbit.h])
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += $(STDBIT_H)
+
+# We need the following in order to create <stdbit.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_STDBIT_H
+stdbit.h: stdbit.in.h $(top_builddir)/config.status
+@NMD@  $(AM_V_GEN)$(MKDIR_P) '%reldir%'
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+         -e 's/@''GL_STDC_LEADING_ZEROS''@/$(GL_STDC_LEADING_ZEROS)/g' \
+         -e 's/@''GL_STDC_LEADING_ONES''@/$(GL_STDC_LEADING_ONES)/g' \
+         -e 's/@''GL_STDC_TRAILING_ZEROS''@/$(GL_STDC_TRAILING_ZEROS)/g' \
+         -e 's/@''GL_STDC_TRAILING_ONES''@/$(GL_STDC_TRAILING_ONES)/g' \
+         -e 's/@''GL_STDC_FIRST_LEADING_ZERO''@/$(GL_STDC_FIRST_LEADING_ZERO)/g' \
+         -e 's/@''GL_STDC_FIRST_LEADING_ONE''@/$(GL_STDC_FIRST_LEADING_ONE)/g' \
+         -e 's/@''GL_STDC_FIRST_TRAILING_ZERO''@/$(GL_STDC_FIRST_TRAILING_ZERO)/g' \
+         -e 's/@''GL_STDC_FIRST_TRAILING_ONE''@/$(GL_STDC_FIRST_TRAILING_ONE)/g' \
+         -e 's/@''GL_STDC_COUNT_ZEROS''@/$(GL_STDC_COUNT_ZEROS)/g' \
+         -e 's/@''GL_STDC_COUNT_ONES''@/$(GL_STDC_COUNT_ONES)/g' \
+         -e 's/@''GL_STDC_HAS_SINGLE_BIT''@/$(GL_STDC_HAS_SINGLE_BIT)/g' \
+         -e 's/@''GL_STDC_BIT_WIDTH''@/$(GL_STDC_BIT_WIDTH)/g' \
+         -e 's/@''GL_STDC_BIT_FLOOR''@/$(GL_STDC_BIT_FLOOR)/g' \
+         -e 's/@''GL_STDC_BIT_CEIL''@/$(GL_STDC_BIT_CEIL)/g' \
+         $(srcdir)/stdbit.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
+lib_SOURCES += stdbit.c
+else
+stdbit.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += stdbit.h stdbit.h-t
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdbit-tests b/modules/stdbit-tests
deleted file mode 100644 (file)
index 15386be..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-Files:
-tests/macros.h
-tests/from-glibc/support/test-driver.c
-tests/from-glibc/tst-stdbit.h
-tests/from-glibc/tst-stdc_bit_ceil.c
-tests/from-glibc/tst-stdc_bit_floor.c
-tests/from-glibc/tst-stdc_bit_width.c
-tests/from-glibc/tst-stdc_count_ones.c
-tests/from-glibc/tst-stdc_count_zeros.c
-tests/from-glibc/tst-stdc_first_leading_one.c
-tests/from-glibc/tst-stdc_first_leading_zero.c
-tests/from-glibc/tst-stdc_first_trailing_one.c
-tests/from-glibc/tst-stdc_first_trailing_zero.c
-tests/from-glibc/tst-stdc_has_single_bit.c
-tests/from-glibc/tst-stdc_leading_ones.c
-tests/from-glibc/tst-stdc_leading_zeros.c
-tests/from-glibc/tst-stdc_trailing_ones.c
-tests/from-glibc/tst-stdc_trailing_zeros.c
-
-Depends-on:
-assert-h
-libc-config
-stdint
-
-configure.ac:
-
-Makefile.am:
-TESTS += \
-   test-stdc_bit_ceil test-stdc_bit_floor test-stdc_bit_width \
-   test-stdc_count_ones test-stdc_count_zeros test-stdc_first_leading_one \
-   test-stdc_first_leading_zero test-stdc_first_trailing_one \
-   test-stdc_first_trailing_zero test-stdc_has_single_bit \
-   test-stdc_leading_ones test-stdc_leading_zeros test-stdc_trailing_ones \
-   test-stdc_trailing_zeros
-
-check_PROGRAMS += \
-   test-stdc_bit_ceil test-stdc_bit_floor test-stdc_bit_width \
-   test-stdc_count_ones test-stdc_count_zeros test-stdc_first_leading_one \
-   test-stdc_first_leading_zero test-stdc_first_trailing_one \
-   test-stdc_first_trailing_zero test-stdc_has_single_bit \
-   test-stdc_leading_ones test-stdc_leading_zeros test-stdc_trailing_ones \
-   test-stdc_trailing_zeros
-
-TEST_STDBIT_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
-
-test_stdc_bit_ceil_SOURCES             = from-glibc/tst-stdc_bit_ceil.c
-test_stdc_bit_ceil_CPPFLAGS            = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_bit_floor_SOURCES            = from-glibc/tst-stdc_bit_floor.c
-test_stdc_bit_floor_CPPFLAGS           = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_bit_width_SOURCES            = from-glibc/tst-stdc_bit_width.c
-test_stdc_bit_width_CPPFLAGS           = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_count_ones_SOURCES           = from-glibc/tst-stdc_count_ones.c
-test_stdc_count_ones_CPPFLAGS          = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_count_zeros_SOURCES          = from-glibc/tst-stdc_count_zeros.c
-test_stdc_count_zeros_CPPFLAGS         = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_first_leading_one_SOURCES    = from-glibc/tst-stdc_first_leading_one.c
-test_stdc_first_leading_one_CPPFLAGS   = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_first_leading_zero_SOURCES   = from-glibc/tst-stdc_first_leading_zero.c
-test_stdc_first_leading_zero_CPPFLAGS  = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_first_trailing_one_SOURCES   = from-glibc/tst-stdc_first_trailing_one.c
-test_stdc_first_trailing_one_CPPFLAGS  = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_first_trailing_zero_SOURCES  = from-glibc/tst-stdc_first_trailing_zero.c
-test_stdc_first_trailing_zero_CPPFLAGS = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_has_single_bit_SOURCES       = from-glibc/tst-stdc_has_single_bit.c
-test_stdc_has_single_bit_CPPFLAGS      = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_leading_ones_SOURCES         = from-glibc/tst-stdc_leading_ones.c
-test_stdc_leading_ones_CPPFLAGS        = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_leading_zeros_SOURCES        = from-glibc/tst-stdc_leading_zeros.c
-test_stdc_leading_zeros_CPPFLAGS       = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_trailing_ones_SOURCES        = from-glibc/tst-stdc_trailing_ones.c
-test_stdc_trailing_ones_CPPFLAGS       = $(TEST_STDBIT_CPPFLAGS)
-
-test_stdc_trailing_zeros_SOURCES       = from-glibc/tst-stdc_trailing_zeros.c
-test_stdc_trailing_zeros_CPPFLAGS      = $(TEST_STDBIT_CPPFLAGS)
diff --git a/modules/stdc_bit_ceil b/modules/stdc_bit_ceil
new file mode 100644 (file)
index 0000000..d08f14d
--- /dev/null
@@ -0,0 +1,28 @@
+Description:
+stdc_bit_ceil macro, stdc_bit_ceil_* functions:
+Return the smallest power of 2 that is ≥ a given unsigned integer.
+
+Files:
+lib/stdc_bit_ceil.c
+
+Depends-on:
+stdbit-h
+stdc_bit_width
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_BIT_CEIL=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_bit_ceil.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_bit_ceil-tests b/modules/stdc_bit_ceil-tests
new file mode 100644 (file)
index 0000000..67fd8eb
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_bit_ceil.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_bit_ceil
+check_PROGRAMS += test-stdc_bit_ceil
+test_stdc_bit_ceil_SOURCES = from-glibc/tst-stdc_bit_ceil.c
+test_stdc_bit_ceil_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_bit_floor b/modules/stdc_bit_floor
new file mode 100644 (file)
index 0000000..9d83bf1
--- /dev/null
@@ -0,0 +1,28 @@
+Description:
+stdc_bit_floor macro, stdc_bit_floor_* functions:
+Return the largest power of 2 that is ≤ a given unsigned integer.
+
+Files:
+lib/stdc_bit_floor.c
+
+Depends-on:
+stdbit-h
+stdc_bit_width
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_BIT_FLOOR=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_bit_floor.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_bit_floor-tests b/modules/stdc_bit_floor-tests
new file mode 100644 (file)
index 0000000..5eb9359
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_bit_floor.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_bit_floor
+check_PROGRAMS += test-stdc_bit_floor
+test_stdc_bit_floor_SOURCES = from-glibc/tst-stdc_bit_floor.c
+test_stdc_bit_floor_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_bit_width b/modules/stdc_bit_width
new file mode 100644 (file)
index 0000000..2c25725
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+stdc_bit_width macro, stdc_bit_width_* functions:
+Return the minimum number of bits required to represent an unsigned integer
+value.
+
+Files:
+lib/stdc_bit_width.c
+
+Depends-on:
+stdbit-h
+stdc_leading_zeros
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_BIT_WIDTH=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_bit_width.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_bit_width-tests b/modules/stdc_bit_width-tests
new file mode 100644 (file)
index 0000000..0c26422
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_bit_width.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_bit_width
+check_PROGRAMS += test-stdc_bit_width
+test_stdc_bit_width_SOURCES = from-glibc/tst-stdc_bit_width.c
+test_stdc_bit_width_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_count_ones b/modules/stdc_count_ones
new file mode 100644 (file)
index 0000000..38ee1d5
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+stdc_count_ones macro, stdc_count_ones_* functions:
+Return the number of 1 bits in an unsigned integer.
+
+Files:
+lib/stdc_count_ones.c
+
+Depends-on:
+stdbit-h
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_COUNT_ONES=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_count_ones.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_count_ones-tests b/modules/stdc_count_ones-tests
new file mode 100644 (file)
index 0000000..c7fc0bf
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_count_ones.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_count_ones
+check_PROGRAMS += test-stdc_count_ones
+test_stdc_count_ones_SOURCES = from-glibc/tst-stdc_count_ones.c
+test_stdc_count_ones_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_count_zeros b/modules/stdc_count_zeros
new file mode 100644 (file)
index 0000000..ff10513
--- /dev/null
@@ -0,0 +1,28 @@
+Description:
+stdc_count_zeros macro, stdc_count_zeros_* functions:
+Return the number of 0 bits in an unsigned integer.
+
+Files:
+lib/stdc_count_zeros.c
+
+Depends-on:
+stdbit-h
+stdc_count_ones
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_COUNT_ZEROS=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_count_zeros.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_count_zeros-tests b/modules/stdc_count_zeros-tests
new file mode 100644 (file)
index 0000000..c78f710
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_count_zeros.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_count_zeros
+check_PROGRAMS += test-stdc_count_zeros
+test_stdc_count_zeros_SOURCES = from-glibc/tst-stdc_count_zeros.c
+test_stdc_count_zeros_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_first_leading_one b/modules/stdc_first_leading_one
new file mode 100644 (file)
index 0000000..e494dc0
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+stdc_first_leading_one macro, stdc_first_leading_one_* functions
+Return the number of bits, from the most significant 1 bit to the most
+significant bit, in an unsigned integer.
+
+Files:
+lib/stdc_first_leading_one.c
+
+Depends-on:
+stdbit-h
+stdc_leading_zeros
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_FIRST_LEADING_ONE=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_first_leading_one.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_first_leading_one-tests b/modules/stdc_first_leading_one-tests
new file mode 100644 (file)
index 0000000..4ec69f5
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_first_leading_one.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_first_leading_one
+check_PROGRAMS += test-stdc_first_leading_one
+test_stdc_first_leading_one_SOURCES = from-glibc/tst-stdc_first_leading_one.c
+test_stdc_first_leading_one_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_first_leading_zero b/modules/stdc_first_leading_zero
new file mode 100644 (file)
index 0000000..f72c692
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+stdc_first_leading_zero macro, stdc_first_leading_zero_* functions:
+Return the number of bits, from the most significant 0 bit to the most
+significant bit, in an unsigned integer.
+
+Files:
+lib/stdc_first_leading_zero.c
+
+Depends-on:
+stdbit-h
+stdc_leading_ones
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_FIRST_LEADING_ZERO=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_first_leading_zero.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_first_leading_zero-tests b/modules/stdc_first_leading_zero-tests
new file mode 100644 (file)
index 0000000..cf65406
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_first_leading_zero.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_first_leading_zero
+check_PROGRAMS += test-stdc_first_leading_zero
+test_stdc_first_leading_zero_SOURCES = from-glibc/tst-stdc_first_leading_zero.c
+test_stdc_first_leading_zero_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_first_trailing_one b/modules/stdc_first_trailing_one
new file mode 100644 (file)
index 0000000..41e0b70
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+stdc_first_trailing_one macro, stdc_first_trailing_one_* functions:
+Return the number of bits, from the least significant 1 bit to the least
+significant bit, in an unsigned integer.
+
+Files:
+lib/stdc_first_trailing_one.c
+
+Depends-on:
+stdbit-h
+stdc_trailing_zeros
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_FIRST_TRAILING_ONE=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_first_trailing_one.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_first_trailing_one-tests b/modules/stdc_first_trailing_one-tests
new file mode 100644 (file)
index 0000000..a021e12
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_first_trailing_one.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_first_trailing_one
+check_PROGRAMS += test-stdc_first_trailing_one
+test_stdc_first_trailing_one_SOURCES = from-glibc/tst-stdc_first_trailing_one.c
+test_stdc_first_trailing_one_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_first_trailing_zero b/modules/stdc_first_trailing_zero
new file mode 100644 (file)
index 0000000..b194a33
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+stdc_first_trailing_zero macro, stdc_first_trailing_zero_* functions:
+Return the number of bits, from the least significant 0 bit to the least
+significant bit, in an unsigned integer.
+
+Files:
+lib/stdc_first_trailing_zero.c
+
+Depends-on:
+stdbit-h
+stdc_trailing_ones
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_FIRST_TRAILING_ZERO=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_first_trailing_zero.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_first_trailing_zero-tests b/modules/stdc_first_trailing_zero-tests
new file mode 100644 (file)
index 0000000..e7e5416
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_first_trailing_zero.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_first_trailing_zero
+check_PROGRAMS += test-stdc_first_trailing_zero
+test_stdc_first_trailing_zero_SOURCES = from-glibc/tst-stdc_first_trailing_zero.c
+test_stdc_first_trailing_zero_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_has_single_bit b/modules/stdc_has_single_bit
new file mode 100644 (file)
index 0000000..f7f4459
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+stdc_has_single_bit macro, stdc_has_single_bit_* functions:
+Test whether an unsigned integer has exactly one 1 bit.
+
+Files:
+lib/stdc_has_single_bit.c
+
+Depends-on:
+stdbit-h
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_HAS_SINGLE_BIT=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_has_single_bit.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_has_single_bit-tests b/modules/stdc_has_single_bit-tests
new file mode 100644 (file)
index 0000000..2540299
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_has_single_bit.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_has_single_bit
+check_PROGRAMS += test-stdc_has_single_bit
+test_stdc_has_single_bit_SOURCES = from-glibc/tst-stdc_has_single_bit.c
+test_stdc_has_single_bit_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_leading_ones b/modules/stdc_leading_ones
new file mode 100644 (file)
index 0000000..92e3518
--- /dev/null
@@ -0,0 +1,28 @@
+Description:
+stdc_leading_ones macro, stdc_leading_ones_* functions:
+Return the number of leading 1 bits in an unsigned integer.
+
+Files:
+lib/stdc_leading_ones.c
+
+Depends-on:
+stdbit-h
+stdc_leading_zeros
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_LEADING_ONES=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_leading_ones.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_leading_ones-tests b/modules/stdc_leading_ones-tests
new file mode 100644 (file)
index 0000000..b890136
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_leading_ones.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_leading_ones
+check_PROGRAMS += test-stdc_leading_ones
+test_stdc_leading_ones_SOURCES = from-glibc/tst-stdc_leading_ones.c
+test_stdc_leading_ones_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_leading_zeros b/modules/stdc_leading_zeros
new file mode 100644 (file)
index 0000000..9a0bd06
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+stdc_leading_zeros macro, stdc_leading_zeros_* functions:
+Return the number of leading 0 bits in an unsigned integer.
+
+Files:
+lib/stdc_leading_zeros.c
+
+Depends-on:
+stdbit-h
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_LEADING_ZEROS=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_leading_zeros.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_leading_zeros-tests b/modules/stdc_leading_zeros-tests
new file mode 100644 (file)
index 0000000..0d7bfb6
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_leading_zeros.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_leading_zeros
+check_PROGRAMS += test-stdc_leading_zeros
+test_stdc_leading_zeros_SOURCES = from-glibc/tst-stdc_leading_zeros.c
+test_stdc_leading_zeros_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_trailing_ones b/modules/stdc_trailing_ones
new file mode 100644 (file)
index 0000000..7154127
--- /dev/null
@@ -0,0 +1,28 @@
+Description:
+stdc_trailing_ones macro, stdc_trailing_ones_* functions:
+Return the number of trailing 1 bits in an unsigned integer.
+
+Files:
+lib/stdc_trailing_ones.c
+
+Depends-on:
+stdbit-h
+stdc_trailing_zeros
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_TRAILING_ONES=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_trailing_ones.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_trailing_ones-tests b/modules/stdc_trailing_ones-tests
new file mode 100644 (file)
index 0000000..24bde0b
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_trailing_ones.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_trailing_ones
+check_PROGRAMS += test-stdc_trailing_ones
+test_stdc_trailing_ones_SOURCES = from-glibc/tst-stdc_trailing_ones.c
+test_stdc_trailing_ones_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT
diff --git a/modules/stdc_trailing_zeros b/modules/stdc_trailing_zeros
new file mode 100644 (file)
index 0000000..4572dde
--- /dev/null
@@ -0,0 +1,27 @@
+Description:
+stdc_trailing_zeros macro, stdc_trailing_zeros_* functions:
+Return the number of trailing 0 bits in an unsigned integer.
+
+Files:
+lib/stdc_trailing_zeros.c
+
+Depends-on:
+stdbit-h
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+GL_STDC_TRAILING_ZEROS=1
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_trailing_zeros.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stdc_trailing_zeros-tests b/modules/stdc_trailing_zeros-tests
new file mode 100644 (file)
index 0000000..5ed01df
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/from-glibc/tst-stdc_trailing_zeros.c
+tests/from-glibc/tst-stdbit.h
+tests/from-glibc/support/test-driver.c
+tests/macros.h
+
+Depends-on:
+libc-config
+stdbool
+stdint
+assert-h
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_trailing_zeros
+check_PROGRAMS += test-stdc_trailing_zeros
+test_stdc_trailing_zeros_SOURCES = from-glibc/tst-stdc_trailing_zeros.c
+test_stdc_trailing_zeros_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/from-glibc -DGNULIB_TEST_STDBIT