mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
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.
This commit is contained in:
80
ChangeLog
80
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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
348
lib/stdbit.in.h
348
lib/stdbit.in.h
@@ -26,9 +26,52 @@
|
||||
#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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.5 Count Trailing Zeros */
|
||||
|
||||
#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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.6 Count Trailing Ones */
|
||||
|
||||
#if @GL_STDC_TRAILING_ONES@
|
||||
|
||||
_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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.7 First Leading Zero */
|
||||
|
||||
#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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.9 First Trailing Zero */
|
||||
|
||||
#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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.10 First Trailing One */
|
||||
|
||||
#if @GL_STDC_FIRST_TRAILING_ONE@
|
||||
|
||||
_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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.12 Count Ones */
|
||||
|
||||
#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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.11 Count Zeros */
|
||||
|
||||
#if @GL_STDC_COUNT_ZEROS@
|
||||
|
||||
_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
|
||||
|
||||
_GL_STDBIT_INLINE bool
|
||||
|
||||
/* ISO C 23 § 7.18.13 Single-bit Check */
|
||||
|
||||
#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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned int
|
||||
|
||||
/* ISO C 23 § 7.18.14 Bit Width */
|
||||
|
||||
#if @GL_STDC_BIT_WIDTH@
|
||||
|
||||
_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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned char
|
||||
|
||||
/* ISO C 23 § 7.18.15 Bit Floor */
|
||||
|
||||
#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
|
||||
|
||||
_GL_STDBIT_INLINE unsigned char
|
||||
|
||||
/* ISO C 23 § 7.18.16 Bit Ceiling */
|
||||
|
||||
#if @GL_STDC_BIT_CEIL@
|
||||
|
||||
_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
|
||||
}
|
||||
|
20
lib/stdc_bit_ceil.c
Normal file
20
lib/stdc_bit_ceil.c
Normal file
@@ -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>
|
20
lib/stdc_bit_floor.c
Normal file
20
lib/stdc_bit_floor.c
Normal file
@@ -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>
|
20
lib/stdc_bit_width.c
Normal file
20
lib/stdc_bit_width.c
Normal file
@@ -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>
|
24
lib/stdc_count_ones.c
Normal file
24
lib/stdc_count_ones.c
Normal file
@@ -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
|
20
lib/stdc_count_zeros.c
Normal file
20
lib/stdc_count_zeros.c
Normal file
@@ -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>
|
20
lib/stdc_first_leading_one.c
Normal file
20
lib/stdc_first_leading_one.c
Normal file
@@ -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>
|
20
lib/stdc_first_leading_zero.c
Normal file
20
lib/stdc_first_leading_zero.c
Normal file
@@ -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>
|
20
lib/stdc_first_trailing_one.c
Normal file
20
lib/stdc_first_trailing_one.c
Normal file
@@ -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>
|
20
lib/stdc_first_trailing_zero.c
Normal file
20
lib/stdc_first_trailing_zero.c
Normal file
@@ -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>
|
20
lib/stdc_has_single_bit.c
Normal file
20
lib/stdc_has_single_bit.c
Normal file
@@ -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>
|
20
lib/stdc_leading_ones.c
Normal file
20
lib/stdc_leading_ones.c
Normal file
@@ -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>
|
20
lib/stdc_leading_zeros.c
Normal file
20
lib/stdc_leading_zeros.c
Normal file
@@ -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>
|
20
lib/stdc_trailing_ones.c
Normal file
20
lib/stdc_trailing_ones.c
Normal file
@@ -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>
|
20
lib/stdc_trailing_zeros.c
Normal file
20
lib/stdc_trailing_zeros.c
Normal file
@@ -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>
|
@@ -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])
|
||||
])
|
||||
|
@@ -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>
|
||||
|
58
modules/stdbit-h
Normal file
58
modules/stdbit-h
Normal file
@@ -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
|
@@ -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)
|
28
modules/stdc_bit_ceil
Normal file
28
modules/stdc_bit_ceil
Normal file
@@ -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
|
19
modules/stdc_bit_ceil-tests
Normal file
19
modules/stdc_bit_ceil-tests
Normal file
@@ -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
|
28
modules/stdc_bit_floor
Normal file
28
modules/stdc_bit_floor
Normal file
@@ -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
|
19
modules/stdc_bit_floor-tests
Normal file
19
modules/stdc_bit_floor-tests
Normal file
@@ -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
|
29
modules/stdc_bit_width
Normal file
29
modules/stdc_bit_width
Normal file
@@ -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
|
19
modules/stdc_bit_width-tests
Normal file
19
modules/stdc_bit_width-tests
Normal file
@@ -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
|
27
modules/stdc_count_ones
Normal file
27
modules/stdc_count_ones
Normal file
@@ -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
|
19
modules/stdc_count_ones-tests
Normal file
19
modules/stdc_count_ones-tests
Normal file
@@ -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
|
28
modules/stdc_count_zeros
Normal file
28
modules/stdc_count_zeros
Normal file
@@ -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
|
19
modules/stdc_count_zeros-tests
Normal file
19
modules/stdc_count_zeros-tests
Normal file
@@ -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
|
29
modules/stdc_first_leading_one
Normal file
29
modules/stdc_first_leading_one
Normal file
@@ -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
|
19
modules/stdc_first_leading_one-tests
Normal file
19
modules/stdc_first_leading_one-tests
Normal file
@@ -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
|
29
modules/stdc_first_leading_zero
Normal file
29
modules/stdc_first_leading_zero
Normal file
@@ -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
|
19
modules/stdc_first_leading_zero-tests
Normal file
19
modules/stdc_first_leading_zero-tests
Normal file
@@ -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
|
29
modules/stdc_first_trailing_one
Normal file
29
modules/stdc_first_trailing_one
Normal file
@@ -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
|
19
modules/stdc_first_trailing_one-tests
Normal file
19
modules/stdc_first_trailing_one-tests
Normal file
@@ -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
|
29
modules/stdc_first_trailing_zero
Normal file
29
modules/stdc_first_trailing_zero
Normal file
@@ -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
|
19
modules/stdc_first_trailing_zero-tests
Normal file
19
modules/stdc_first_trailing_zero-tests
Normal file
@@ -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
|
27
modules/stdc_has_single_bit
Normal file
27
modules/stdc_has_single_bit
Normal file
@@ -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
|
19
modules/stdc_has_single_bit-tests
Normal file
19
modules/stdc_has_single_bit-tests
Normal file
@@ -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
|
28
modules/stdc_leading_ones
Normal file
28
modules/stdc_leading_ones
Normal file
@@ -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
|
19
modules/stdc_leading_ones-tests
Normal file
19
modules/stdc_leading_ones-tests
Normal file
@@ -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
|
27
modules/stdc_leading_zeros
Normal file
27
modules/stdc_leading_zeros
Normal file
@@ -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
|
19
modules/stdc_leading_zeros-tests
Normal file
19
modules/stdc_leading_zeros-tests
Normal file
@@ -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
|
28
modules/stdc_trailing_ones
Normal file
28
modules/stdc_trailing_ones
Normal file
@@ -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
|
19
modules/stdc_trailing_ones-tests
Normal file
19
modules/stdc_trailing_ones-tests
Normal file
@@ -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
|
27
modules/stdc_trailing_zeros
Normal file
27
modules/stdc_trailing_zeros
Normal file
@@ -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
|
19
modules/stdc_trailing_zeros-tests
Normal file
19
modules/stdc_trailing_zeros-tests
Normal file
@@ -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
|
Reference in New Issue
Block a user