Implement C23 <stdbit.h>

C23 adds a header <stdbit.h> with various functions and type-generic
macros for bit-manipulation of unsigned integers (plus macro defines
related to endianness).  Implement this header for glibc.

The functions have both inline definitions in the header (referenced
by macros defined in the header) and copies with external linkage in
the library (which are implemented in terms of those macros to avoid
duplication).  They are documented in the glibc manual.  Tests, as
well as verifying results for various inputs (of both the macros and
the out-of-line functions), verify the types of those results (which
showed up a bug in an earlier version with the type-generic macro
stdc_has_single_bit wrongly returning a promoted type), that the
macros can be used at top level in a source file (so don't use ({})),
that they evaluate their arguments exactly once, and that the macros
for the type-specific functions have the expected implicit conversions
to the relevant argument type.

Jakub previously referred to -Wconversion warnings in type-generic
macros, so I've included a test with -Wconversion (but the only
warnings I saw and fixed from that test were actually in inline
functions in the <stdbit.h> header - not anything coming from use of
the type-generic macros themselves).

This implementation of the type-generic macros does not handle
unsigned __int128, or unsigned _BitInt types with a width other than
that of a standard integer type (and C23 doesn't require the header to
handle such types either).  Support for those types, using the new
type-generic built-in functions Jakub's added for GCC 14, can
reasonably be added in a followup (along of course with associated
tests).

This implementation doesn't do anything special to handle C++, or have
any tests of functionality in C++ beyond the existing tests that all
headers can be compiled in C++ code; it's not clear exactly what form
this header should take in C++, but probably not one using macros.

DIS ballot comment AT-107 asks for the word "count" to be added to the
names of the stdc_leading_zeros, stdc_leading_ones,
stdc_trailing_zeros and stdc_trailing_ones functions and macros.  I
don't think it's likely to be accepted (accepting any technical
comments would mean having an FDIS ballot), but if it is accepted at
the WG14 meeting (22-26 January in Strasbourg, starting with DIS
ballot comment handling) then there would still be time to update
glibc for the renaming before the 2.39 release.

The new functions and header are placed in the stdlib/ directory in
glibc, rather than creating a new toplevel stdbit/ or putting them in
string/ alongside ffs.

Tested for x86_64 and x86.
This commit is contained in:
Joseph Myers 2024-01-03 12:07:14 +00:00
parent fe316dad7c
commit b34b46b880
133 changed files with 7011 additions and 15 deletions

9
NEWS
View File

@ -43,6 +43,15 @@ Major new features:
on thread stack created by pthread_create or memory allocated by
malloc).
* The <stdbit.h> header has been added from ISO C2X, with
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
and stdc_bit_ceil function families, each having functions for
unsigned char, unsigned short, unsigned int, unsigned long int and
unsigned long long int, and a type-generic macro.
Deprecated and removed features, and other changes affecting compatibility:
* The ldconfig program now skips file names containing ';' or ending in

36
bits/stdint-least.h Normal file
View File

@ -0,0 +1,36 @@
/* Define int_leastN_t and uint_leastN types.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_STDINT_LEAST_H
#define _BITS_STDINT_LEAST_H 1
#include <bits/types.h>
/* Signed. */
typedef __int_least8_t int_least8_t;
typedef __int_least16_t int_least16_t;
typedef __int_least32_t int_least32_t;
typedef __int_least64_t int_least64_t;
/* Unsigned. */
typedef __uint_least8_t uint_least8_t;
typedef __uint_least16_t uint_least16_t;
typedef __uint_least32_t uint_least32_t;
typedef __uint_least64_t uint_least64_t;
#endif /* bits/stdint-least.h */

1
include/stdbit.h Normal file
View File

@ -0,0 +1 @@
#include <stdlib/stdbit.h>

View File

@ -36,7 +36,7 @@ endif
chapters = $(addsuffix .texi, \
intro errno memory ctype string charset locale \
message search pattern io stdio llio filesys \
pipe socket terminal syslog math arith time \
pipe socket terminal syslog math arith stdbit time \
resource setjmp signal startup process ipc job \
nss users sysinfo conf crypt debug threads \
dynlink probes tunables)

View File

@ -1,4 +1,4 @@
@node Arithmetic, Date and Time, Mathematics, Top
@node Arithmetic, Bit Manipulation, Mathematics, Top
@c %MENU% Low level arithmetic functions
@chapter Arithmetic Functions

206
manual/stdbit.texi Normal file
View File

@ -0,0 +1,206 @@
@node Bit Manipulation, Date and Time, Arithmetic, Top
@c %MENU% Bit manipulation
@chapter Bit Manipulation
This chapter contains information about functions and macros for
determining the endianness of integer types and manipulating the bits
of unsigned integers. These functions and macros are from ISO C2X and
are declared in the header file @file{stdbit.h}.
The following macros describe the endianness of integer types. They
have values that are integer constant expressions.
@defmac __STDC_ENDIAN_LITTLE__
This macro represents little-endian storage.
@end defmac
@defmac __STDC_ENDIAN_BIG__
This macro represents big-endian storage.
@end defmac
@defmac __STDC_ENDIAN_NATIVE__
This macro equals @code{__STDC_ENDIAN_LITTLE__} if integer types are
stored in memory in little-endian format, and equals
@code{__STDC_ENDIAN_BIG__} if integer types are stored in memory in
big-endian format.
@end defmac
The following functions manipulate the bits of unsigned integers.
Each function family has functions for the types @code{unsigned char},
@code{unsigned short}, @code{unsigned int}, @code{unsigned long int}
and @code{unsigned long long int}. In addition, there is a
corresponding type-generic macro (not listed below), named the same as
the functions but without any suffix such as @samp{_uc}. The
type-generic macro can only be used with an argument of an unsigned
integer type with a width of 8, 16, 32 or 64 bits.
@deftypefun {unsigned int} stdc_leading_zeros_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_leading_zeros_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_leading_zeros_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_leading_zeros_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_leading_zeros_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_leading_zeros} functions count the number of leading
(most significant) zero bits in @var{x}, starting from the most
significant bit of the argument type. If @var{x} is zero, they return
the width of @var{x} in bits.
@end deftypefun
@deftypefun {unsigned int} stdc_leading_ones_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_leading_ones_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_leading_ones_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_leading_ones_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_leading_ones_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_leading_ones} functions count the number of leading
(most significant) one bits in @var{x}, starting from the most
significant bit of the argument type.
@end deftypefun
@deftypefun {unsigned int} stdc_trailing_zeros_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_trailing_zeros_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_trailing_zeros_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_trailing_zeros_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_trailing_zeros_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_trailing_zeros} functions count the number of trailing
(least significant) zero bits in @var{x}, starting from the least
significant bit of the argument type. If @var{x} is zero, they return
the width of @var{x} in bits.
@end deftypefun
@deftypefun {unsigned int} stdc_trailing_ones_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_trailing_ones_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_trailing_ones_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_trailing_ones_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_trailing_ones_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_trailing_ones} functions count the number of trailing
(least significant) one bits in @var{x}, starting from the least
significant bit of the argument type.
@end deftypefun
@deftypefun {unsigned int} stdc_first_leading_zero_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_first_leading_zero_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_first_leading_zero_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_first_leading_zero_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_first_leading_zero_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_first_leading_zero} functions return the position of
the most significant zero bit in @var{x}, counting from the most
significant bit of @var{x} as 1, or zero if there is no zero bit in
@var{x}.
@end deftypefun
@deftypefun {unsigned int} stdc_first_leading_one_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_first_leading_one_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_first_leading_one_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_first_leading_one_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_first_leading_one_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_first_leading_one} functions return the position of the
most significant one bit in @var{x}, counting from the most
significant bit of @var{x} as 1, or zero if there is no one bit in
@var{x}.
@end deftypefun
@deftypefun {unsigned int} stdc_first_trailing_zero_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_zero_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_zero_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_zero_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_zero_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_first_trailing_zero} functions return the position of
the least significant zero bit in @var{x}, counting from the least
significant bit of @var{x} as 1, or zero if there is no zero bit in
@var{x}.
@end deftypefun
@deftypefun {unsigned int} stdc_first_trailing_one_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_one_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_one_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_one_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_first_trailing_one_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_first_trailing_one} functions return the position of
the least significant one bit in @var{x}, counting from the least
significant bit of @var{x} as 1, or zero if there is no one bit in
@var{x}.
@end deftypefun
@deftypefun {unsigned int} stdc_count_zeros_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_count_zeros_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_count_zeros_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_count_zeros_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_count_zeros_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_count_zeros} functions count the number of zero bits in
@var{x}.
@end deftypefun
@deftypefun {unsigned int} stdc_count_ones_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_count_ones_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_count_ones_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_count_ones_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_count_ones_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_count_ones} functions count the number of one bits in
@var{x}.
@end deftypefun
@deftypefun {_Bool} stdc_has_single_bit_uc (unsigned char @var{x})
@deftypefunx {_Bool} stdc_has_single_bit_us (unsigned short @var{x})
@deftypefunx {_Bool} stdc_has_single_bit_ui (unsigned int @var{x})
@deftypefunx {_Bool} stdc_has_single_bit_ul (unsigned long int @var{x})
@deftypefunx {_Bool} stdc_has_single_bit_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_has_single_bit} functions return whether @var{x} has
exactly one bit set to one.
@end deftypefun
@deftypefun {unsigned int} stdc_bit_width_uc (unsigned char @var{x})
@deftypefunx {unsigned int} stdc_bit_width_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_bit_width_ui (unsigned int @var{x})
@deftypefunx {unsigned int} stdc_bit_width_ul (unsigned long int @var{x})
@deftypefunx {unsigned int} stdc_bit_width_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_bit_width} functions return the minimum number of bits
needed to store @var{x}, not counting leading zero bits. If @var{x}
is zero, they return zero.
@end deftypefun
@deftypefun {unsigned char} stdc_bit_floor_uc (unsigned char @var{x})
@deftypefunx {unsigned short} stdc_bit_floor_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_bit_floor_ui (unsigned int @var{x})
@deftypefunx {unsigned long int} stdc_bit_floor_ul (unsigned long int @var{x})
@deftypefunx {unsigned long long int} stdc_bit_floor_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_bit_floor} functions return the largest integer power
of two that is less than or equal to @var{x}. If @var{x} is zero,
they return zero.
@end deftypefun
@deftypefun {unsigned char} stdc_bit_ceil_uc (unsigned char @var{x})
@deftypefunx {unsigned short} stdc_bit_ceil_us (unsigned short @var{x})
@deftypefunx {unsigned int} stdc_bit_ceil_ui (unsigned int @var{x})
@deftypefunx {unsigned long int} stdc_bit_ceil_ul (unsigned long int @var{x})
@deftypefunx {unsigned long long int} stdc_bit_ceil_ull (unsigned long long int @var{x})
@standards{C2X, stdbit.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The @code{stdc_bit_ceil} functions return the smallest integer power
of two that is greater than or equal to @var{x}. If this cannot be
represented in the return type, they return zero.
@end deftypefun

View File

@ -1,4 +1,4 @@
@node Date and Time, Resource Usage And Limitation, Arithmetic, Top
@node Date and Time, Resource Usage And Limitation, Bit Manipulation, Top
@c %MENU% Functions for getting the date and time and formatting them nicely
@chapter Date and Time

View File

@ -28,6 +28,7 @@ headers := \
bits/indirect-return.h \
bits/monetary-ldbl.h \
bits/stdint-intn.h \
bits/stdint-least.h \
bits/stdint-uintn.h \
bits/stdlib-bsearch.h \
bits/stdlib-float.h \
@ -41,6 +42,7 @@ headers := \
fmtmsg.h \
inttypes.h \
monetary.h \
stdbit.h \
stdint.h \
stdlib.h \
sys/errno.h \
@ -115,6 +117,76 @@ routines := \
setenv \
srand48 \
srand48_r \
stdc_bit_ceil_uc \
stdc_bit_ceil_ui \
stdc_bit_ceil_ul \
stdc_bit_ceil_ull \
stdc_bit_ceil_us \
stdc_bit_floor_uc \
stdc_bit_floor_ui \
stdc_bit_floor_ul \
stdc_bit_floor_ull \
stdc_bit_floor_us \
stdc_bit_width_uc \
stdc_bit_width_ui \
stdc_bit_width_ul \
stdc_bit_width_ull \
stdc_bit_width_us \
stdc_count_ones_uc \
stdc_count_ones_ui \
stdc_count_ones_ul \
stdc_count_ones_ull \
stdc_count_ones_us \
stdc_count_zeros_uc \
stdc_count_zeros_ui \
stdc_count_zeros_ul \
stdc_count_zeros_ull \
stdc_count_zeros_us \
stdc_first_leading_one_uc \
stdc_first_leading_one_ui \
stdc_first_leading_one_ul \
stdc_first_leading_one_ull \
stdc_first_leading_one_us \
stdc_first_leading_zero_uc \
stdc_first_leading_zero_ui \
stdc_first_leading_zero_ul \
stdc_first_leading_zero_ull \
stdc_first_leading_zero_us \
stdc_first_trailing_one_uc \
stdc_first_trailing_one_ui \
stdc_first_trailing_one_ul \
stdc_first_trailing_one_ull \
stdc_first_trailing_one_us \
stdc_first_trailing_zero_uc \
stdc_first_trailing_zero_ui \
stdc_first_trailing_zero_ul \
stdc_first_trailing_zero_ull \
stdc_first_trailing_zero_us \
stdc_has_single_bit_uc \
stdc_has_single_bit_ui \
stdc_has_single_bit_ul \
stdc_has_single_bit_ull \
stdc_has_single_bit_us \
stdc_leading_ones_uc \
stdc_leading_ones_ui \
stdc_leading_ones_ul \
stdc_leading_ones_ull \
stdc_leading_ones_us \
stdc_leading_zeros_uc \
stdc_leading_zeros_ui \
stdc_leading_zeros_ul \
stdc_leading_zeros_ull \
stdc_leading_zeros_us \
stdc_trailing_ones_uc \
stdc_trailing_ones_ui \
stdc_trailing_ones_ul \
stdc_trailing_ones_ull \
stdc_trailing_ones_us \
stdc_trailing_zeros_uc \
stdc_trailing_zeros_ui \
stdc_trailing_zeros_ul \
stdc_trailing_zeros_ull \
stdc_trailing_zeros_us \
strfmon \
strfmon_l \
strfromd \
@ -236,6 +308,21 @@ tests := \
tst-setcontext9 \
tst-setcontext10 \
tst-setcontext11 \
tst-stdbit-Wconversion \
tst-stdc_bit_ceil \
tst-stdc_bit_floor \
tst-stdc_bit_width \
tst-stdc_count_ones \
tst-stdc_count_zeros \
tst-stdc_first_leading_one \
tst-stdc_first_leading_zero \
tst-stdc_first_trailing_one \
tst-stdc_first_trailing_zero \
tst-stdc_has_single_bit \
tst-stdc_leading_ones \
tst-stdc_leading_zeros \
tst-stdc_trailing_ones \
tst-stdc_trailing_zeros \
tst-strfmon_l \
tst-strfrom \
tst-strfrom-locale \
@ -307,6 +394,22 @@ CFLAGS-tst-abs.c += -fno-builtin
CFLAGS-tst-labs.c += -fno-builtin
CFLAGS-tst-llabs.c += -fno-builtin
CFLAGS-tst-stdbit-Wconversion.c += -Wconversion -Werror
CFLAGS-tst-stdc_trailing_zeros.c += -fno-builtin
CFLAGS-tst-stdc_trailing_ones.c += -fno-builtin
CFLAGS-tst-stdc_leading_zeros.c += -fno-builtin
CFLAGS-tst-stdc_leading_ones.c += -fno-builtin
CFLAGS-tst-stdc_has_single_bit.c += -fno-builtin
CFLAGS-tst-stdc_first_trailing_zero.c += -fno-builtin
CFLAGS-tst-stdc_first_trailing_one.c += -fno-builtin
CFLAGS-tst-stdc_first_leading_zero.c += -fno-builtin
CFLAGS-tst-stdc_first_leading_one.c += -fno-builtin
CFLAGS-tst-stdc_count_zeros.c += -fno-builtin
CFLAGS-tst-stdc_count_ones.c += -fno-builtin
CFLAGS-tst-stdc_bit_width.c += -fno-builtin
CFLAGS-tst-stdc_bit_floor.c += -fno-builtin
CFLAGS-tst-stdc_bit_ceil.c += -fno-builtin
ifeq ($(have-cxx-thread_local),yes)
CFLAGS-tst-quick_exit.o = -std=c++11
LDLIBS-tst-quick_exit = -lstdc++

View File

@ -151,6 +151,78 @@ libc {
__isoc23_strtoimax;
__isoc23_strtoumax;
}
GLIBC_2.39 {
stdc_leading_zeros_uc;
stdc_leading_zeros_us;
stdc_leading_zeros_ui;
stdc_leading_zeros_ul;
stdc_leading_zeros_ull;
stdc_leading_ones_uc;
stdc_leading_ones_us;
stdc_leading_ones_ui;
stdc_leading_ones_ul;
stdc_leading_ones_ull;
stdc_trailing_zeros_uc;
stdc_trailing_zeros_us;
stdc_trailing_zeros_ui;
stdc_trailing_zeros_ul;
stdc_trailing_zeros_ull;
stdc_trailing_ones_uc;
stdc_trailing_ones_us;
stdc_trailing_ones_ui;
stdc_trailing_ones_ul;
stdc_trailing_ones_ull;
stdc_first_leading_zero_uc;
stdc_first_leading_zero_us;
stdc_first_leading_zero_ui;
stdc_first_leading_zero_ul;
stdc_first_leading_zero_ull;
stdc_first_leading_one_uc;
stdc_first_leading_one_us;
stdc_first_leading_one_ui;
stdc_first_leading_one_ul;
stdc_first_leading_one_ull;
stdc_first_trailing_zero_uc;
stdc_first_trailing_zero_us;
stdc_first_trailing_zero_ui;
stdc_first_trailing_zero_ul;
stdc_first_trailing_zero_ull;
stdc_first_trailing_one_uc;
stdc_first_trailing_one_us;
stdc_first_trailing_one_ui;
stdc_first_trailing_one_ul;
stdc_first_trailing_one_ull;
stdc_count_zeros_uc;
stdc_count_zeros_us;
stdc_count_zeros_ui;
stdc_count_zeros_ul;
stdc_count_zeros_ull;
stdc_count_ones_uc;
stdc_count_ones_us;
stdc_count_ones_ui;
stdc_count_ones_ul;
stdc_count_ones_ull;
stdc_has_single_bit_uc;
stdc_has_single_bit_us;
stdc_has_single_bit_ui;
stdc_has_single_bit_ul;
stdc_has_single_bit_ull;
stdc_bit_width_uc;
stdc_bit_width_us;
stdc_bit_width_ui;
stdc_bit_width_ul;
stdc_bit_width_ull;
stdc_bit_floor_uc;
stdc_bit_floor_us;
stdc_bit_floor_ui;
stdc_bit_floor_ul;
stdc_bit_floor_ull;
stdc_bit_ceil_uc;
stdc_bit_ceil_us;
stdc_bit_ceil_ui;
stdc_bit_ceil_ul;
stdc_bit_ceil_ull;
}
GLIBC_PRIVATE {
# functions which have an additional interface since they are
# are cancelable.

773
stdlib/stdbit.h Normal file
View File

@ -0,0 +1,773 @@
/* ISO C23 Standard: 7.18 - Bit and byte utilities <stdbit.h>.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _STDBIT_H
#define _STDBIT_H 1
#include <features.h>
#include <bits/endian.h>
#include <bits/stdint-intn.h>
#include <bits/stdint-uintn.h>
#include <bits/stdint-least.h>
/* In C23, <stdbool.h> defines only an implementation-namespace macro,
so is OK to include here. Before C23, including <stdbool.h> allows
the header to use bool rather than _Bool unconditionally, and so to
compile as C++ (although the type-generic macros are not a good
form of type-generic interface for C++). */
#include <stdbool.h>
#define __need_size_t
#include <stddef.h>
#define __STDC_VERSION_STDBIT_H__ 202311L
#define __STDC_ENDIAN_LITTLE__ __LITTLE_ENDIAN
#define __STDC_ENDIAN_BIG__ __BIG_ENDIAN
#define __STDC_ENDIAN_NATIVE__ __BYTE_ORDER
__BEGIN_DECLS
/* Count leading zeros. */
extern unsigned int stdc_leading_zeros_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_leading_zeros_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_leading_zeros_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_leading_zeros_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_leading_zeros_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_leading_zeros(x) \
(stdc_leading_zeros_ull (x) \
- (unsigned int) (8 * (sizeof (0ULL) - sizeof (x))))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
static __always_inline unsigned int
__clz64_inline (uint64_t __x)
{
return __x == 0 ? 64U : (unsigned int) __builtin_clzll (__x);
}
static __always_inline unsigned int
__clz32_inline (uint32_t __x)
{
return __x == 0 ? 32U : (unsigned int) __builtin_clz (__x);
}
static __always_inline unsigned int
__clz16_inline (uint16_t __x)
{
return __clz32_inline (__x) - 16;
}
static __always_inline unsigned int
__clz8_inline (uint8_t __x)
{
return __clz32_inline (__x) - 24;
}
# define stdc_leading_zeros_uc(x) (__clz8_inline (x))
# define stdc_leading_zeros_us(x) (__clz16_inline (x))
# define stdc_leading_zeros_ui(x) (__clz32_inline (x))
# if __WORDSIZE == 64
# define stdc_leading_zeros_ul(x) (__clz64_inline (x))
# else
# define stdc_leading_zeros_ul(x) (__clz32_inline (x))
# endif
# define stdc_leading_zeros_ull(x) (__clz64_inline (x))
#endif
/* Count leading ones. */
extern unsigned int stdc_leading_ones_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_leading_ones_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_leading_ones_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_leading_ones_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_leading_ones_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_leading_ones(x) \
(stdc_leading_ones_ull ((unsigned long long int) (x) \
<< 8 * (sizeof (0ULL) - sizeof (x))))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
static __always_inline unsigned int
__clo64_inline (uint64_t __x)
{
return __clz64_inline (~__x);
}
static __always_inline unsigned int
__clo32_inline (uint32_t __x)
{
return __clz32_inline (~__x);
}
static __always_inline unsigned int
__clo16_inline (uint16_t __x)
{
return __clz16_inline (~__x);
}
static __always_inline unsigned int
__clo8_inline (uint8_t __x)
{
return __clz8_inline (~__x);
}
# define stdc_leading_ones_uc(x) (__clo8_inline (x))
# define stdc_leading_ones_us(x) (__clo16_inline (x))
# define stdc_leading_ones_ui(x) (__clo32_inline (x))
# if __WORDSIZE == 64
# define stdc_leading_ones_ul(x) (__clo64_inline (x))
# else
# define stdc_leading_ones_ul(x) (__clo32_inline (x))
# endif
# define stdc_leading_ones_ull(x) (__clo64_inline (x))
#endif
/* Count trailing zeros. */
extern unsigned int stdc_trailing_zeros_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_trailing_zeros_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_trailing_zeros_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_trailing_zeros_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_trailing_zeros_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_trailing_zeros(x) \
(sizeof (x) == 8 ? stdc_trailing_zeros_ull (x) \
: sizeof (x) == 4 ? stdc_trailing_zeros_ui (x) \
: sizeof (x) == 2 ? stdc_trailing_zeros_us (x) \
: stdc_trailing_zeros_uc (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
static __always_inline unsigned int
__ctz64_inline (uint64_t __x)
{
return __x == 0 ? 64U : (unsigned int) __builtin_ctzll (__x);
}
static __always_inline unsigned int
__ctz32_inline (uint32_t __x)
{
return __x == 0 ? 32U : (unsigned int) __builtin_ctz (__x);
}
static __always_inline unsigned int
__ctz16_inline (uint16_t __x)
{
return __x == 0 ? 16U : (unsigned int) __builtin_ctz (__x);
}
static __always_inline unsigned int
__ctz8_inline (uint8_t __x)
{
return __x == 0 ? 8U : (unsigned int) __builtin_ctz (__x);
}
# define stdc_trailing_zeros_uc(x) (__ctz8_inline (x))
# define stdc_trailing_zeros_us(x) (__ctz16_inline (x))
# define stdc_trailing_zeros_ui(x) (__ctz32_inline (x))
# if __WORDSIZE == 64
# define stdc_trailing_zeros_ul(x) (__ctz64_inline (x))
# else
# define stdc_trailing_zeros_ul(x) (__ctz32_inline (x))
# endif
# define stdc_trailing_zeros_ull(x) (__ctz64_inline (x))
#endif
/* Count trailing ones. */
extern unsigned int stdc_trailing_ones_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_trailing_ones_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_trailing_ones_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_trailing_ones_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_trailing_ones_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_trailing_ones(x) (stdc_trailing_ones_ull (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
static __always_inline unsigned int
__cto64_inline (uint64_t __x)
{
return __ctz64_inline (~__x);
}
static __always_inline unsigned int
__cto32_inline (uint32_t __x)
{
return __ctz32_inline (~__x);
}
static __always_inline unsigned int
__cto16_inline (uint16_t __x)
{
return __ctz16_inline (~__x);
}
static __always_inline unsigned int
__cto8_inline (uint8_t __x)
{
return __ctz8_inline (~__x);
}
# define stdc_trailing_ones_uc(x) (__cto8_inline (x))
# define stdc_trailing_ones_us(x) (__cto16_inline (x))
# define stdc_trailing_ones_ui(x) (__cto32_inline (x))
# if __WORDSIZE == 64
# define stdc_trailing_ones_ul(x) (__cto64_inline (x))
# else
# define stdc_trailing_ones_ul(x) (__cto32_inline (x))
# endif
# define stdc_trailing_ones_ull(x) (__cto64_inline (x))
#endif
/* First leading zero. */
extern unsigned int stdc_first_leading_zero_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_leading_zero_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_leading_zero_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_leading_zero_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_first_leading_zero_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_first_leading_zero(x) \
(sizeof (x) == 8 ? stdc_first_leading_zero_ull (x) \
: sizeof (x) == 4 ? stdc_first_leading_zero_ui (x) \
: sizeof (x) == 2 ? stdc_first_leading_zero_us (x) \
: stdc_first_leading_zero_uc (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
static __always_inline unsigned int
__flz64_inline (uint64_t __x)
{
return __x == (uint64_t) -1 ? 0 : 1 + __clo64_inline (__x);
}
static __always_inline unsigned int
__flz32_inline (uint32_t __x)
{
return __x == (uint32_t) -1 ? 0 : 1 + __clo32_inline (__x);
}
static __always_inline unsigned int
__flz16_inline (uint16_t __x)
{
return __x == (uint16_t) -1 ? 0 : 1 + __clo16_inline (__x);
}
static __always_inline unsigned int
__flz8_inline (uint8_t __x)
{
return __x == (uint8_t) -1 ? 0 : 1 + __clo8_inline (__x);
}
# define stdc_first_leading_zero_uc(x) (__flz8_inline (x))
# define stdc_first_leading_zero_us(x) (__flz16_inline (x))
# define stdc_first_leading_zero_ui(x) (__flz32_inline (x))
# if __WORDSIZE == 64
# define stdc_first_leading_zero_ul(x) (__flz64_inline (x))
# else
# define stdc_first_leading_zero_ul(x) (__flz32_inline (x))
# endif
# define stdc_first_leading_zero_ull(x) (__flz64_inline (x))
#endif
/* First leading one. */
extern unsigned int stdc_first_leading_one_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_leading_one_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_leading_one_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_leading_one_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_first_leading_one_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_first_leading_one(x) \
(sizeof (x) == 8 ? stdc_first_leading_one_ull (x) \
: sizeof (x) == 4 ? stdc_first_leading_one_ui (x) \
: sizeof (x) == 2 ? stdc_first_leading_one_us (x) \
: stdc_first_leading_one_uc (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
static __always_inline unsigned int
__flo64_inline (uint64_t __x)
{
return __x == 0 ? 0 : 1 + __clz64_inline (__x);
}
static __always_inline unsigned int
__flo32_inline (uint32_t __x)
{
return __x == 0 ? 0 : 1 + __clz32_inline (__x);
}
static __always_inline unsigned int
__flo16_inline (uint16_t __x)
{
return __x == 0 ? 0 : 1 + __clz16_inline (__x);
}
static __always_inline unsigned int
__flo8_inline (uint8_t __x)
{
return __x == 0 ? 0 : 1 + __clz8_inline (__x);
}
# define stdc_first_leading_one_uc(x) (__flo8_inline (x))
# define stdc_first_leading_one_us(x) (__flo16_inline (x))
# define stdc_first_leading_one_ui(x) (__flo32_inline (x))
# if __WORDSIZE == 64
# define stdc_first_leading_one_ul(x) (__flo64_inline (x))
# else
# define stdc_first_leading_one_ul(x) (__flo32_inline (x))
# endif
# define stdc_first_leading_one_ull(x) (__flo64_inline (x))
#endif
/* First trailing zero. */
extern unsigned int stdc_first_trailing_zero_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_trailing_zero_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_trailing_zero_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_trailing_zero_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_first_trailing_zero_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_first_trailing_zero(x) \
(sizeof (x) == 8 ? stdc_first_trailing_zero_ull (x) \
: sizeof (x) == 4 ? stdc_first_trailing_zero_ui (x) \
: sizeof (x) == 2 ? stdc_first_trailing_zero_us (x) \
: stdc_first_trailing_zero_uc (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
static __always_inline unsigned int
__ftz64_inline (uint64_t __x)
{
return __x == (uint64_t) -1 ? 0 : 1 + __cto64_inline (__x);
}
static __always_inline unsigned int
__ftz32_inline (uint32_t __x)
{
return __x == (uint32_t) -1 ? 0 : 1 + __cto32_inline (__x);
}
static __always_inline unsigned int
__ftz16_inline (uint16_t __x)
{
return __x == (uint16_t) -1 ? 0 : 1 + __cto16_inline (__x);
}
static __always_inline unsigned int
__ftz8_inline (uint8_t __x)
{
return __x == (uint8_t) -1 ? 0 : 1 + __cto8_inline (__x);
}
# define stdc_first_trailing_zero_uc(x) (__ftz8_inline (x))
# define stdc_first_trailing_zero_us(x) (__ftz16_inline (x))
# define stdc_first_trailing_zero_ui(x) (__ftz32_inline (x))
# if __WORDSIZE == 64
# define stdc_first_trailing_zero_ul(x) (__ftz64_inline (x))
# else
# define stdc_first_trailing_zero_ul(x) (__ftz32_inline (x))
# endif
# define stdc_first_trailing_zero_ull(x) (__ftz64_inline (x))
#endif
/* First trailing one. */
extern unsigned int stdc_first_trailing_one_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_trailing_one_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_trailing_one_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_first_trailing_one_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_first_trailing_one_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_first_trailing_one(x) \
(sizeof (x) == 8 ? stdc_first_trailing_one_ull (x) \
: sizeof (x) == 4 ? stdc_first_trailing_one_ui (x) \
: sizeof (x) == 2 ? stdc_first_trailing_one_us (x) \
: stdc_first_trailing_one_uc (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_ctzll)
static __always_inline unsigned int
__fto64_inline (uint64_t __x)
{
return __x == 0 ? 0 : 1 + __ctz64_inline (__x);
}
static __always_inline unsigned int
__fto32_inline (uint32_t __x)
{
return __x == 0 ? 0 : 1 + __ctz32_inline (__x);
}
static __always_inline unsigned int
__fto16_inline (uint16_t __x)
{
return __x == 0 ? 0 : 1 + __ctz16_inline (__x);
}
static __always_inline unsigned int
__fto8_inline (uint8_t __x)
{
return __x == 0 ? 0 : 1 + __ctz8_inline (__x);
}
# define stdc_first_trailing_one_uc(x) (__fto8_inline (x))
# define stdc_first_trailing_one_us(x) (__fto16_inline (x))
# define stdc_first_trailing_one_ui(x) (__fto32_inline (x))
# if __WORDSIZE == 64
# define stdc_first_trailing_one_ul(x) (__fto64_inline (x))
# else
# define stdc_first_trailing_one_ul(x) (__fto32_inline (x))
# endif
# define stdc_first_trailing_one_ull(x) (__fto64_inline (x))
#endif
/* Count zeros. */
extern unsigned int stdc_count_zeros_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_count_zeros_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_count_zeros_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_count_zeros_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_count_zeros_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_count_zeros(x) \
(stdc_count_zeros_ull (x) \
- (unsigned int) (8 * (sizeof (0ULL) - sizeof (x))))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_popcountll)
static __always_inline unsigned int
__cz64_inline (uint64_t __x)
{
return 64U - (unsigned int) __builtin_popcountll (__x);
}
static __always_inline unsigned int
__cz32_inline (uint32_t __x)
{
return 32U - (unsigned int) __builtin_popcount (__x);
}
static __always_inline unsigned int
__cz16_inline (uint16_t __x)
{
return 16U - (unsigned int) __builtin_popcount (__x);
}
static __always_inline unsigned int
__cz8_inline (uint8_t __x)
{
return 8U - (unsigned int) __builtin_popcount (__x);
}
# define stdc_count_zeros_uc(x) (__cz8_inline (x))
# define stdc_count_zeros_us(x) (__cz16_inline (x))
# define stdc_count_zeros_ui(x) (__cz32_inline (x))
# if __WORDSIZE == 64
# define stdc_count_zeros_ul(x) (__cz64_inline (x))
# else
# define stdc_count_zeros_ul(x) (__cz32_inline (x))
# endif
# define stdc_count_zeros_ull(x) (__cz64_inline (x))
#endif
/* Count ones. */
extern unsigned int stdc_count_ones_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_count_ones_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_count_ones_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_count_ones_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_count_ones_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_count_ones(x) (stdc_count_ones_ull (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_popcountll)
static __always_inline unsigned int
__co64_inline (uint64_t __x)
{
return (unsigned int) __builtin_popcountll (__x);
}
static __always_inline unsigned int
__co32_inline (uint32_t __x)
{
return (unsigned int) __builtin_popcount (__x);
}
static __always_inline unsigned int
__co16_inline (uint16_t __x)
{
return (unsigned int) __builtin_popcount (__x);
}
static __always_inline unsigned int
__co8_inline (uint8_t __x)
{
return (unsigned int) __builtin_popcount (__x);
}
# define stdc_count_ones_uc(x) (__co8_inline (x))
# define stdc_count_ones_us(x) (__co16_inline (x))
# define stdc_count_ones_ui(x) (__co32_inline (x))
# if __WORDSIZE == 64
# define stdc_count_ones_ul(x) (__co64_inline (x))
# else
# define stdc_count_ones_ul(x) (__co32_inline (x))
# endif
# define stdc_count_ones_ull(x) (__co64_inline (x))
#endif
/* Single-bit check. */
extern bool stdc_has_single_bit_uc (unsigned char __x)
__THROW __attribute_const__;
extern bool stdc_has_single_bit_us (unsigned short __x)
__THROW __attribute_const__;
extern bool stdc_has_single_bit_ui (unsigned int __x)
__THROW __attribute_const__;
extern bool stdc_has_single_bit_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern bool stdc_has_single_bit_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_has_single_bit(x) \
((bool) (sizeof (x) <= sizeof (unsigned int) \
? stdc_has_single_bit_ui (x) \
: stdc_has_single_bit_ull (x)))
static __always_inline bool
__hsb64_inline (uint64_t __x)
{
return (__x ^ (__x - 1)) > __x - 1;
}
static __always_inline bool
__hsb32_inline (uint32_t __x)
{
return (__x ^ (__x - 1)) > __x - 1;
}
static __always_inline bool
__hsb16_inline (uint16_t __x)
{
return (__x ^ (__x - 1)) > __x - 1;
}
static __always_inline bool
__hsb8_inline (uint8_t __x)
{
return (__x ^ (__x - 1)) > __x - 1;
}
#define stdc_has_single_bit_uc(x) (__hsb8_inline (x))
#define stdc_has_single_bit_us(x) (__hsb16_inline (x))
#define stdc_has_single_bit_ui(x) (__hsb32_inline (x))
#if __WORDSIZE == 64
# define stdc_has_single_bit_ul(x) (__hsb64_inline (x))
#else
# define stdc_has_single_bit_ul(x) (__hsb32_inline (x))
#endif
#define stdc_has_single_bit_ull(x) (__hsb64_inline (x))
/* Bit width. */
extern unsigned int stdc_bit_width_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned int stdc_bit_width_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_bit_width_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned int stdc_bit_width_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned int stdc_bit_width_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_bit_width(x) (stdc_bit_width_ull (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
static __always_inline unsigned int
__bw64_inline (uint64_t __x)
{
return 64 - __clz64_inline (__x);
}
static __always_inline unsigned int
__bw32_inline (uint32_t __x)
{
return 32 - __clz32_inline (__x);
}
static __always_inline unsigned int
__bw16_inline (uint16_t __x)
{
return 16 - __clz16_inline (__x);
}
static __always_inline unsigned int
__bw8_inline (uint8_t __x)
{
return 8 - __clz8_inline (__x);
}
# define stdc_bit_width_uc(x) (__bw8_inline (x))
# define stdc_bit_width_us(x) (__bw16_inline (x))
# define stdc_bit_width_ui(x) (__bw32_inline (x))
# if __WORDSIZE == 64
# define stdc_bit_width_ul(x) (__bw64_inline (x))
# else
# define stdc_bit_width_ul(x) (__bw32_inline (x))
# endif
# define stdc_bit_width_ull(x) (__bw64_inline (x))
#endif
/* Bit floor. */
extern unsigned char stdc_bit_floor_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned short stdc_bit_floor_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_bit_floor_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned long int stdc_bit_floor_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned long long int stdc_bit_floor_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_bit_floor(x) ((__typeof (x)) stdc_bit_floor_ull (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
static __always_inline uint64_t
__bf64_inline (uint64_t __x)
{
return __x == 0 ? 0 : ((uint64_t) 1) << (__bw64_inline (__x) - 1);
}
static __always_inline uint32_t
__bf32_inline (uint32_t __x)
{
return __x == 0 ? 0 : ((uint32_t) 1) << (__bw32_inline (__x) - 1);
}
static __always_inline uint16_t
__bf16_inline (uint16_t __x)
{
return __x == 0 ? 0 : ((uint16_t) 1) << (__bw16_inline (__x) - 1);
}
static __always_inline uint8_t
__bf8_inline (uint8_t __x)
{
return __x == 0 ? 0 : ((uint8_t) 1) << (__bw8_inline (__x) - 1);
}
# define stdc_bit_floor_uc(x) ((unsigned char) __bf8_inline (x))
# define stdc_bit_floor_us(x) ((unsigned short) __bf16_inline (x))
# define stdc_bit_floor_ui(x) ((unsigned int) __bf32_inline (x))
# if __WORDSIZE == 64
# define stdc_bit_floor_ul(x) ((unsigned long int) __bf64_inline (x))
# else
# define stdc_bit_floor_ul(x) ((unsigned long int) __bf32_inline (x))
# endif
# define stdc_bit_floor_ull(x) ((unsigned long long int) __bf64_inline (x))
#endif
/* Bit ceiling. */
extern unsigned char stdc_bit_ceil_uc (unsigned char __x)
__THROW __attribute_const__;
extern unsigned short stdc_bit_ceil_us (unsigned short __x)
__THROW __attribute_const__;
extern unsigned int stdc_bit_ceil_ui (unsigned int __x)
__THROW __attribute_const__;
extern unsigned long int stdc_bit_ceil_ul (unsigned long int __x)
__THROW __attribute_const__;
__extension__
extern unsigned long long int stdc_bit_ceil_ull (unsigned long long int __x)
__THROW __attribute_const__;
#define stdc_bit_ceil(x) ((__typeof (x)) stdc_bit_ceil_ull (x))
#if __GNUC_PREREQ (3, 4) || __glibc_has_builtin (__builtin_clzll)
static __always_inline uint64_t
__bc64_inline (uint64_t __x)
{
return __x <= 1 ? 1 : ((uint64_t) 2) << (__bw64_inline (__x - 1) - 1);
}
static __always_inline uint32_t
__bc32_inline (uint32_t __x)
{
return __x <= 1 ? 1 : ((uint32_t) 2) << (__bw32_inline (__x - 1) - 1);
}
static __always_inline uint16_t
__bc16_inline (uint16_t __x)
{
return __x <= 1 ? 1 : ((uint16_t) 2) << (__bw16_inline (__x - 1) - 1);
}
static __always_inline uint8_t
__bc8_inline (uint8_t __x)
{
return __x <= 1 ? 1 : ((uint8_t) 2) << (__bw8_inline (__x - 1) - 1);
}
# define stdc_bit_ceil_uc(x) ((unsigned char) __bc8_inline (x))
# define stdc_bit_ceil_us(x) ((unsigned short) __bc16_inline (x))
# define stdc_bit_ceil_ui(x) ((unsigned int) __bc32_inline (x))
# if __WORDSIZE == 64
# define stdc_bit_ceil_ul(x) ((unsigned long int) __bc64_inline (x))
# else
# define stdc_bit_ceil_ul(x) ((unsigned long int) __bc32_inline (x))
# endif
# define stdc_bit_ceil_ull(x) ((unsigned long long int) __bc64_inline (x))
#endif
__END_DECLS
#endif /* _STDBIT_H */

25
stdlib/stdc_bit_ceil_uc.c Normal file
View File

@ -0,0 +1,25 @@
/* Bit ceiling for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned char
(stdc_bit_ceil_uc) (unsigned char x)
{
return stdc_bit_ceil_uc (x);
}

25
stdlib/stdc_bit_ceil_ui.c Normal file
View File

@ -0,0 +1,25 @@
/* Bit ceiling for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_bit_ceil_ui) (unsigned int x)
{
return stdc_bit_ceil_ui (x);
}

25
stdlib/stdc_bit_ceil_ul.c Normal file
View File

@ -0,0 +1,25 @@
/* Bit ceiling for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned long int
(stdc_bit_ceil_ul) (unsigned long int x)
{
return stdc_bit_ceil_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Bit ceiling for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned long long int
(stdc_bit_ceil_ull) (unsigned long long int x)
{
return stdc_bit_ceil_ull (x);
}

25
stdlib/stdc_bit_ceil_us.c Normal file
View File

@ -0,0 +1,25 @@
/* Bit ceiling for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned short
(stdc_bit_ceil_us) (unsigned short x)
{
return stdc_bit_ceil_us (x);
}

View File

@ -0,0 +1,25 @@
/* Bit floor for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned char
(stdc_bit_floor_uc) (unsigned char x)
{
return stdc_bit_floor_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Bit floor for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_bit_floor_ui) (unsigned int x)
{
return stdc_bit_floor_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Bit floor for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned long int
(stdc_bit_floor_ul) (unsigned long int x)
{
return stdc_bit_floor_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Bit floor for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned long long int
(stdc_bit_floor_ull) (unsigned long long int x)
{
return stdc_bit_floor_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Bit floor for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned short
(stdc_bit_floor_us) (unsigned short x)
{
return stdc_bit_floor_us (x);
}

View File

@ -0,0 +1,25 @@
/* Bit width for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_bit_width_uc) (unsigned char x)
{
return stdc_bit_width_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Bit width for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_bit_width_ui) (unsigned int x)
{
return stdc_bit_width_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Bit width for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_bit_width_ul) (unsigned long int x)
{
return stdc_bit_width_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Bit width for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_bit_width_ull) (unsigned long long int x)
{
return stdc_bit_width_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Bit width for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_bit_width_us) (unsigned short x)
{
return stdc_bit_width_us (x);
}

View File

@ -0,0 +1,25 @@
/* Count ones for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_ones_uc) (unsigned char x)
{
return stdc_count_ones_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Count ones for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_ones_ui) (unsigned int x)
{
return stdc_count_ones_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Count ones for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_ones_ul) (unsigned long int x)
{
return stdc_count_ones_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Count ones for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_ones_ull) (unsigned long long int x)
{
return stdc_count_ones_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Count ones for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_ones_us) (unsigned short x)
{
return stdc_count_ones_us (x);
}

View File

@ -0,0 +1,25 @@
/* Count zeros for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_zeros_uc) (unsigned char x)
{
return stdc_count_zeros_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Count zeros for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_zeros_ui) (unsigned int x)
{
return stdc_count_zeros_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Count zeros for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_zeros_ul) (unsigned long int x)
{
return stdc_count_zeros_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Count zeros for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_zeros_ull) (unsigned long long int x)
{
return stdc_count_zeros_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Count zeros for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_count_zeros_us) (unsigned short x)
{
return stdc_count_zeros_us (x);
}

View File

@ -0,0 +1,25 @@
/* First leading one for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_one_uc) (unsigned char x)
{
return stdc_first_leading_one_uc (x);
}

View File

@ -0,0 +1,25 @@
/* First leading one for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_one_ui) (unsigned int x)
{
return stdc_first_leading_one_ui (x);
}

View File

@ -0,0 +1,25 @@
/* First leading one for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_one_ul) (unsigned long int x)
{
return stdc_first_leading_one_ul (x);
}

View File

@ -0,0 +1,25 @@
/* First leading one for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_one_ull) (unsigned long long int x)
{
return stdc_first_leading_one_ull (x);
}

View File

@ -0,0 +1,25 @@
/* First leading one for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_one_us) (unsigned short x)
{
return stdc_first_leading_one_us (x);
}

View File

@ -0,0 +1,25 @@
/* First leading zero for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_zero_uc) (unsigned char x)
{
return stdc_first_leading_zero_uc (x);
}

View File

@ -0,0 +1,25 @@
/* First leading zero for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_zero_ui) (unsigned int x)
{
return stdc_first_leading_zero_ui (x);
}

View File

@ -0,0 +1,25 @@
/* First leading zero for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_zero_ul) (unsigned long int x)
{
return stdc_first_leading_zero_ul (x);
}

View File

@ -0,0 +1,25 @@
/* First leading zero for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_zero_ull) (unsigned long long int x)
{
return stdc_first_leading_zero_ull (x);
}

View File

@ -0,0 +1,25 @@
/* First leading zero for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_leading_zero_us) (unsigned short x)
{
return stdc_first_leading_zero_us (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing one for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_one_uc) (unsigned char x)
{
return stdc_first_trailing_one_uc (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing one for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_one_ui) (unsigned int x)
{
return stdc_first_trailing_one_ui (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing one for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_one_ul) (unsigned long int x)
{
return stdc_first_trailing_one_ul (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing one for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_one_ull) (unsigned long long int x)
{
return stdc_first_trailing_one_ull (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing one for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_one_us) (unsigned short x)
{
return stdc_first_trailing_one_us (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing zero for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_zero_uc) (unsigned char x)
{
return stdc_first_trailing_zero_uc (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing zero for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_zero_ui) (unsigned int x)
{
return stdc_first_trailing_zero_ui (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing zero for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_zero_ul) (unsigned long int x)
{
return stdc_first_trailing_zero_ul (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing zero for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_zero_ull) (unsigned long long int x)
{
return stdc_first_trailing_zero_ull (x);
}

View File

@ -0,0 +1,25 @@
/* First trailing zero for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_first_trailing_zero_us) (unsigned short x)
{
return stdc_first_trailing_zero_us (x);
}

View File

@ -0,0 +1,25 @@
/* Single-bit check for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
_Bool
(stdc_has_single_bit_uc) (unsigned char x)
{
return stdc_has_single_bit_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Single-bit check for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
_Bool
(stdc_has_single_bit_ui) (unsigned int x)
{
return stdc_has_single_bit_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Single-bit check for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
_Bool
(stdc_has_single_bit_ul) (unsigned long int x)
{
return stdc_has_single_bit_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Single-bit check for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
_Bool
(stdc_has_single_bit_ull) (unsigned long long int x)
{
return stdc_has_single_bit_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Single-bit check for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
_Bool
(stdc_has_single_bit_us) (unsigned short x)
{
return stdc_has_single_bit_us (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading ones for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_ones_uc) (unsigned char x)
{
return stdc_leading_ones_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading ones for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_ones_ui) (unsigned int x)
{
return stdc_leading_ones_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading ones for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_ones_ul) (unsigned long int x)
{
return stdc_leading_ones_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading ones for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_ones_ull) (unsigned long long int x)
{
return stdc_leading_ones_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading ones for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_ones_us) (unsigned short x)
{
return stdc_leading_ones_us (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading zeros for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_zeros_uc) (unsigned char x)
{
return stdc_leading_zeros_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading zeros for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_zeros_ui) (unsigned int x)
{
return stdc_leading_zeros_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading zeros for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_zeros_ul) (unsigned long int x)
{
return stdc_leading_zeros_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading zeros for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_zeros_ull) (unsigned long long int x)
{
return stdc_leading_zeros_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Count leading zeros for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_leading_zeros_us) (unsigned short x)
{
return stdc_leading_zeros_us (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing ones for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_ones_uc) (unsigned char x)
{
return stdc_trailing_ones_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing ones for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_ones_ui) (unsigned int x)
{
return stdc_trailing_ones_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing ones for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_ones_ul) (unsigned long int x)
{
return stdc_trailing_ones_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing ones for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_ones_ull) (unsigned long long int x)
{
return stdc_trailing_ones_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing ones for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_ones_us) (unsigned short x)
{
return stdc_trailing_ones_us (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing zeros for unsigned char.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_zeros_uc) (unsigned char x)
{
return stdc_trailing_zeros_uc (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing zeros for unsigned int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_zeros_ui) (unsigned int x)
{
return stdc_trailing_zeros_ui (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing zeros for unsigned long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_zeros_ul) (unsigned long int x)
{
return stdc_trailing_zeros_ul (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing zeros for unsigned long long int.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_zeros_ull) (unsigned long long int x)
{
return stdc_trailing_zeros_ull (x);
}

View File

@ -0,0 +1,25 @@
/* Count trailing zeros for unsigned short.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
unsigned int
(stdc_trailing_zeros_us) (unsigned short x)
{
return stdc_trailing_zeros_us (x);
}

View File

@ -38,18 +38,7 @@
/* Small types. */
/* Signed. */
typedef __int_least8_t int_least8_t;
typedef __int_least16_t int_least16_t;
typedef __int_least32_t int_least32_t;
typedef __int_least64_t int_least64_t;
/* Unsigned. */
typedef __uint_least8_t uint_least8_t;
typedef __uint_least16_t uint_least16_t;
typedef __uint_least32_t uint_least32_t;
typedef __uint_least64_t uint_least64_t;
#include <bits/stdint-least.h>
/* Fast types. */

View File

@ -0,0 +1,107 @@
/* Test <stdbit.h> type-generic macros with -Wconversion.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdbit.h>
#include <support/check.h>
unsigned char uc;
unsigned short us;
unsigned int ui;
unsigned long int ul;
unsigned long long int ull;
static int
do_test (void)
{
/* The main point of this test is the compile-time test that there
are no -Wconversion warnings from the type-generic macros, not
the runtime execution of those macros. */
(void) stdc_leading_zeros (uc);
(void) stdc_leading_zeros (us);
(void) stdc_leading_zeros (ui);
(void) stdc_leading_zeros (ul);
(void) stdc_leading_zeros (ull);
(void) stdc_leading_ones (uc);
(void) stdc_leading_ones (us);
(void) stdc_leading_ones (ui);
(void) stdc_leading_ones (ul);
(void) stdc_leading_ones (ull);
(void) stdc_trailing_zeros (uc);
(void) stdc_trailing_zeros (us);
(void) stdc_trailing_zeros (ui);
(void) stdc_trailing_zeros (ul);
(void) stdc_trailing_zeros (ull);
(void) stdc_trailing_ones (uc);
(void) stdc_trailing_ones (us);
(void) stdc_trailing_ones (ui);
(void) stdc_trailing_ones (ul);
(void) stdc_trailing_ones (ull);
(void) stdc_first_leading_zero (uc);
(void) stdc_first_leading_zero (us);
(void) stdc_first_leading_zero (ui);
(void) stdc_first_leading_zero (ul);
(void) stdc_first_leading_zero (ull);
(void) stdc_first_leading_one (uc);
(void) stdc_first_leading_one (us);
(void) stdc_first_leading_one (ui);
(void) stdc_first_leading_one (ul);
(void) stdc_first_leading_one (ull);
(void) stdc_first_trailing_zero (uc);
(void) stdc_first_trailing_zero (us);
(void) stdc_first_trailing_zero (ui);
(void) stdc_first_trailing_zero (ul);
(void) stdc_first_trailing_zero (ull);
(void) stdc_first_trailing_one (uc);
(void) stdc_first_trailing_one (us);
(void) stdc_first_trailing_one (ui);
(void) stdc_first_trailing_one (ul);
(void) stdc_first_trailing_one (ull);
(void) stdc_count_zeros (uc);
(void) stdc_count_zeros (us);
(void) stdc_count_zeros (ui);
(void) stdc_count_zeros (ul);
(void) stdc_count_zeros (ull);
(void) stdc_count_ones (uc);
(void) stdc_count_ones (us);
(void) stdc_count_ones (ui);
(void) stdc_count_ones (ul);
(void) stdc_count_ones (ull);
(void) stdc_has_single_bit (uc);
(void) stdc_has_single_bit (us);
(void) stdc_has_single_bit (ui);
(void) stdc_has_single_bit (ul);
(void) stdc_has_single_bit (ull);
(void) stdc_bit_width (uc);
(void) stdc_bit_width (us);
(void) stdc_bit_width (ui);
(void) stdc_bit_width (ul);
(void) stdc_bit_width (ull);
(void) stdc_bit_floor (uc);
(void) stdc_bit_floor (us);
(void) stdc_bit_floor (ui);
(void) stdc_bit_floor (ul);
(void) stdc_bit_floor (ull);
(void) stdc_bit_ceil (uc);
(void) stdc_bit_ceil (us);
(void) stdc_bit_ceil (ui);
(void) stdc_bit_ceil (ul);
(void) stdc_bit_ceil (ull);
return 0;
}
#include <support/test-driver.c>

198
stdlib/tst-stdbit.h Normal file
View File

@ -0,0 +1,198 @@
/* Common test support for <stdbit.h> tests.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _TST_STDBIT_H
#define _TST_STDBIT_H
#include <stdbit.h>
#include <stdbool.h>
#include <array_length.h>
#include <support/check.h>
struct stdbit_test
{
/* The test input. */
uint64_t x;
/* Expected results if that test input is converted to 8, 16, 32 or
64 bits and then passed to the function under test for that
width. */
uint64_t res_8, res_16, res_32, res_64;
};
#define TEST_TYPE(EXPR, TYPE) \
_Static_assert (_Generic ((EXPR), TYPE: 1, default: 0), "bad type")
/* Test a <stdbit.h> function / macro. For each function family, and
each input type, we test both with and without macros from the
header being used, both with a possibly wider argument being passed
(that must be truncated by the prototype) and with the argument
truncated in the caller, as well as testing the type-generic macro
(with the argument truncated in the caller). Also test that the
results have the correct type; also test truncation from
floating-point arguments (valid for functions, including with macro
expansion, because the prototype must implicitly convert to integer
type; not valid for the type-generic macros). Also test that the
argument is evaluated exactly once. Also test the macros are
usable (e.g. in typeof) at top level (GCC doesn't allow ({})
outside functions: bug 93239). */
#define TEST_STDBIT_T(FUNC, X, RES, TTYPE, TYPE, SUFFIX) \
do \
{ \
TEST_COMPARE (FUNC ## SUFFIX (X), (RES)); \
TEST_TYPE (FUNC ## SUFFIX (X), TTYPE); \
TEST_COMPARE ((FUNC ## SUFFIX) (X), (RES)); \
TEST_TYPE ((FUNC ## SUFFIX) (X), TTYPE); \
TEST_COMPARE (FUNC ## SUFFIX ((TYPE) (X)), (RES)); \
TEST_TYPE (FUNC ## SUFFIX ((TYPE) (X)), TTYPE); \
TEST_COMPARE ((FUNC ## SUFFIX) ((TYPE) (X)), (RES)); \
TEST_TYPE ((FUNC ## SUFFIX) ((TYPE) (X)), TTYPE); \
TEST_COMPARE (FUNC ((TYPE) (X)), (RES)); \
TEST_TYPE (FUNC ((TYPE) (X)), TTYPE); \
if (sizeof (TYPE) <= 2) \
{ \
TEST_COMPARE (FUNC ## SUFFIX ((float) (TYPE) (X)), (RES)); \
TEST_TYPE (FUNC ## SUFFIX ((float) (TYPE) (X)), TTYPE); \
TEST_COMPARE ((FUNC ## SUFFIX) ((float) (TYPE) (X)), (RES)); \
TEST_TYPE ((FUNC ## SUFFIX) ((float) (TYPE) (X)), TTYPE); \
} \
if (sizeof (TYPE) <= 4) \
{ \
TEST_COMPARE (FUNC ## SUFFIX ((double) (TYPE) (X)), (RES)); \
TEST_TYPE (FUNC ## SUFFIX ((double) (TYPE) (X)), TTYPE); \
TEST_COMPARE ((FUNC ## SUFFIX) ((double) (TYPE) (X)), (RES)); \
TEST_TYPE ((FUNC ## SUFFIX) ((double) (TYPE) (X)), TTYPE); \
TEST_COMPARE (FUNC ## SUFFIX ((long double) (TYPE) (X)), (RES)); \
TEST_TYPE (FUNC ## SUFFIX ((long double) (TYPE) (X)), TTYPE); \
TEST_COMPARE ((FUNC ## SUFFIX) ((long double) (TYPE) (X)), (RES)); \
TEST_TYPE ((FUNC ## SUFFIX) ((long double) (TYPE) (X)), TTYPE); \
} \
TYPE xt = (X); \
TEST_COMPARE (FUNC ## SUFFIX (xt++), (RES)); \
TEST_COMPARE (xt, (TYPE) ((X) + 1)); \
xt = (X); \
TEST_COMPARE (FUNC (xt++), (RES)); \
TEST_COMPARE (xt, (TYPE) ((X) + 1)); \
} \
while (0)
#define TEST_STDBIT_UI(FUNC, INPUTS) \
do \
for (int i = 0; i < array_length (INPUTS); i++) \
{ \
uint64_t x = (INPUTS)[i].x; \
unsigned int res_8 = (INPUTS)[i].res_8; \
unsigned int res_16 = (INPUTS)[i].res_16; \
unsigned int res_32 = (INPUTS)[i].res_32; \
unsigned int res_64 = (INPUTS)[i].res_64; \
unsigned int res_l = (sizeof (long int) == 4 \
? res_32 : res_64); \
TEST_STDBIT_T (FUNC, x, res_8, unsigned int, \
unsigned char, _uc); \
TEST_STDBIT_T (FUNC, x, res_16, unsigned int, \
unsigned short, _us); \
TEST_STDBIT_T (FUNC, x, res_32, unsigned int, \
unsigned int, _ui); \
TEST_STDBIT_T (FUNC, x, res_l, unsigned int, \
unsigned long int, _ul); \
TEST_STDBIT_T (FUNC, x, res_64, unsigned int, \
unsigned long long int, _ull); \
} \
while (0)
#define TEST_STDBIT_BOOL(FUNC, INPUTS) \
do \
for (int i = 0; i < array_length (INPUTS); i++) \
{ \
uint64_t x = (INPUTS)[i].x; \
bool res_8 = (INPUTS)[i].res_8; \
bool res_16 = (INPUTS)[i].res_16; \
bool res_32 = (INPUTS)[i].res_32; \
bool res_64 = (INPUTS)[i].res_64; \
bool res_l = (sizeof (long int) == 4 ? res_32 : res_64); \
TEST_STDBIT_T (FUNC, x, res_8, _Bool, unsigned char, _uc); \
TEST_STDBIT_T (FUNC, x, res_16, _Bool, unsigned short, _us); \
TEST_STDBIT_T (FUNC, x, res_32, _Bool, unsigned int, _ui); \
TEST_STDBIT_T (FUNC, x, res_l, _Bool, unsigned long int, _ul); \
TEST_STDBIT_T (FUNC, x, res_64, _Bool, \
unsigned long long int, _ull); \
} \
while (0)
#define TEST_STDBIT_SAME(FUNC, INPUTS) \
do \
for (int i = 0; i < array_length (INPUTS); i++) \
{ \
uint64_t x = (INPUTS)[i].x; \
unsigned char res_8 = (INPUTS)[i].res_8; \
unsigned short res_16 = (INPUTS)[i].res_16; \
unsigned int res_32 = (INPUTS)[i].res_32; \
unsigned long long int res_64 = (INPUTS)[i].res_64; \
unsigned long int res_l = (sizeof (long int) == 4 \
? res_32 : res_64); \
TEST_STDBIT_T (FUNC, x, res_8, unsigned char, \
unsigned char, _uc); \
TEST_STDBIT_T (FUNC, x, res_16, unsigned short, \
unsigned short, _us); \
TEST_STDBIT_T (FUNC, x, res_32, unsigned int, \
unsigned int, _ui); \
TEST_STDBIT_T (FUNC, x, res_l, unsigned long int, \
unsigned long int, _ul); \
TEST_STDBIT_T (FUNC, x, res_64, unsigned long long int, \
unsigned long long int, _ull); \
} \
while (0)
#define TEST_STDBIT_UI_TOPLEVEL(FUNC) \
TEST_TYPE (FUNC ## _uc ((unsigned char) 0), unsigned int); \
TEST_TYPE (FUNC ((unsigned char) 0), unsigned int); \
TEST_TYPE (FUNC ## _us ((unsigned short) 0), unsigned int); \
TEST_TYPE (FUNC ((unsigned short) 0), unsigned int); \
TEST_TYPE (FUNC ## _ui (0U), unsigned int); \
TEST_TYPE (FUNC (0U), unsigned int); \
TEST_TYPE (FUNC ## _ul (0UL), unsigned int); \
TEST_TYPE (FUNC (0UL), unsigned int); \
TEST_TYPE (FUNC ## _ull (0ULL), unsigned int); \
TEST_TYPE (FUNC (0ULL), unsigned int)
#define TEST_STDBIT_BOOL_TOPLEVEL(FUNC) \
TEST_TYPE (FUNC ## _uc ((unsigned char) 0), _Bool); \
TEST_TYPE (FUNC ((unsigned char) 0), _Bool); \
TEST_TYPE (FUNC ## _us ((unsigned short) 0), _Bool); \
TEST_TYPE (FUNC ((unsigned short) 0), _Bool); \
TEST_TYPE (FUNC ## _ui (0U), _Bool); \
TEST_TYPE (FUNC (0U), _Bool); \
TEST_TYPE (FUNC ## _ul (0UL), _Bool); \
TEST_TYPE (FUNC (0UL), _Bool); \
TEST_TYPE (FUNC ## _ull (0ULL), _Bool); \
TEST_TYPE (FUNC (0ULL), _Bool)
#define TEST_STDBIT_SAME_TOPLEVEL(FUNC) \
TEST_TYPE (FUNC ## _uc ((unsigned char) 0), unsigned char); \
TEST_TYPE (FUNC ((unsigned char) 0), unsigned char); \
TEST_TYPE (FUNC ## _us ((unsigned short) 0), unsigned short); \
TEST_TYPE (FUNC ((unsigned short) 0), unsigned short); \
TEST_TYPE (FUNC ## _ui (0U), unsigned int); \
TEST_TYPE (FUNC (0U), unsigned int); \
TEST_TYPE (FUNC ## _ul (0UL), unsigned long int); \
TEST_TYPE (FUNC (0UL), unsigned long int); \
TEST_TYPE (FUNC ## _ull (0ULL), unsigned long long int); \
TEST_TYPE (FUNC (0ULL), unsigned long long int)
#endif

View File

@ -0,0 +1,88 @@
/* Test stdc_bit_ceil functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0x1, 0x1, 0x1, 0x1ULL },
{ 0x1ULL, 0x1, 0x1, 0x1, 0x1ULL },
{ 0x2ULL, 0x2, 0x2, 0x2, 0x2ULL },
{ 0x3ULL, 0x4, 0x4, 0x4, 0x4ULL },
{ 0x4ULL, 0x4, 0x4, 0x4, 0x4ULL },
{ 0x5ULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0x6ULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0x7ULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0x8ULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0x9ULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0xaULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0xbULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0xcULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0xdULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0xeULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0xfULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0x10ULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0x11ULL, 0x20, 0x20, 0x20, 0x20ULL },
{ 0x12ULL, 0x20, 0x20, 0x20, 0x20ULL },
{ 0x1fULL, 0x20, 0x20, 0x20, 0x20ULL },
{ 0x20ULL, 0x20, 0x20, 0x20, 0x20ULL },
{ 0x7fULL, 0x80, 0x80, 0x80, 0x80ULL },
{ 0x80ULL, 0x80, 0x80, 0x80, 0x80ULL },
{ 0x81ULL, 0, 0x100, 0x100, 0x100ULL },
{ 0x9aULL, 0, 0x100, 0x100, 0x100ULL },
{ 0xf3ULL, 0, 0x100, 0x100, 0x100ULL },
{ 0xffULL, 0, 0x100, 0x100, 0x100ULL },
{ 0x100ULL, 0x1, 0x100, 0x100, 0x100ULL },
{ 0x101ULL, 0x1, 0x200, 0x200, 0x200ULL },
{ 0x102ULL, 0x2, 0x200, 0x200, 0x200ULL },
{ 0x1feULL, 0, 0x200, 0x200, 0x200ULL },
{ 0x1ffULL, 0, 0x200, 0x200, 0x200ULL },
{ 0x200ULL, 0x1, 0x200, 0x200, 0x200ULL },
{ 0x234ULL, 0x40, 0x400, 0x400, 0x400ULL },
{ 0x4567ULL, 0x80, 0x8000, 0x8000, 0x8000ULL },
{ 0x7fffULL, 0, 0x8000, 0x8000, 0x8000ULL },
{ 0x8000ULL, 0x1, 0x8000, 0x8000, 0x8000ULL },
{ 0x8001ULL, 0x1, 0, 0x10000, 0x10000ULL },
{ 0xfffeULL, 0, 0, 0x10000, 0x10000ULL },
{ 0xffffULL, 0, 0, 0x10000, 0x10000ULL },
{ 0x10000ULL, 0x1, 0x1, 0x10000, 0x10000ULL },
{ 0x10001ULL, 0x1, 0x1, 0x20000, 0x20000ULL },
{ 0xfedcba98ULL, 0, 0, 0, 0x100000000ULL },
{ 0xfffffefeULL, 0, 0, 0, 0x100000000ULL },
{ 0xffffffffULL, 0, 0, 0, 0x100000000ULL },
{ 0x100000000ULL, 0x1, 0x1, 0x1, 0x100000000ULL },
{ 0x100000001ULL, 0x1, 0x1, 0x1, 0x200000000ULL },
{ 0x123456789ULL, 0, 0x8000, 0x40000000, 0x200000000ULL },
{ 0x123456789abcdefULL, 0, 0, 0, 0x200000000000000ULL },
{ 0x789abcdef0123456ULL, 0x80, 0x4000, 0, 0x8000000000000000ULL },
{ 0x8000000000000000ULL, 0x1, 0x1, 0x1, 0x8000000000000000ULL },
{ 0x8000000000000001ULL, 0x1, 0x1, 0x1, 0ULL },
{ 0xfffffffffffffffeULL, 0, 0, 0, 0ULL },
{ 0xffffffffffffffffULL, 0, 0, 0, 0ULL },
};
TEST_STDBIT_SAME_TOPLEVEL (stdc_bit_ceil);
static int
do_test (void)
{
TEST_STDBIT_SAME (stdc_bit_ceil, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_bit_floor functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0, 0, 0, 0ULL },
{ 0x1ULL, 0x1, 0x1, 0x1, 0x1ULL },
{ 0x2ULL, 0x2, 0x2, 0x2, 0x2ULL },
{ 0x3ULL, 0x2, 0x2, 0x2, 0x2ULL },
{ 0x4ULL, 0x4, 0x4, 0x4, 0x4ULL },
{ 0x5ULL, 0x4, 0x4, 0x4, 0x4ULL },
{ 0x6ULL, 0x4, 0x4, 0x4, 0x4ULL },
{ 0x7ULL, 0x4, 0x4, 0x4, 0x4ULL },
{ 0x8ULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0x9ULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0xaULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0xbULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0xcULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0xdULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0xeULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0xfULL, 0x8, 0x8, 0x8, 0x8ULL },
{ 0x10ULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0x11ULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0x12ULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0x1fULL, 0x10, 0x10, 0x10, 0x10ULL },
{ 0x20ULL, 0x20, 0x20, 0x20, 0x20ULL },
{ 0x7fULL, 0x40, 0x40, 0x40, 0x40ULL },
{ 0x80ULL, 0x80, 0x80, 0x80, 0x80ULL },
{ 0x81ULL, 0x80, 0x80, 0x80, 0x80ULL },
{ 0x9aULL, 0x80, 0x80, 0x80, 0x80ULL },
{ 0xf3ULL, 0x80, 0x80, 0x80, 0x80ULL },
{ 0xffULL, 0x80, 0x80, 0x80, 0x80ULL },
{ 0x100ULL, 0, 0x100, 0x100, 0x100ULL },
{ 0x101ULL, 0x1, 0x100, 0x100, 0x100ULL },
{ 0x102ULL, 0x2, 0x100, 0x100, 0x100ULL },
{ 0x1feULL, 0x80, 0x100, 0x100, 0x100ULL },
{ 0x1ffULL, 0x80, 0x100, 0x100, 0x100ULL },
{ 0x200ULL, 0, 0x200, 0x200, 0x200ULL },
{ 0x234ULL, 0x20, 0x200, 0x200, 0x200ULL },
{ 0x4567ULL, 0x40, 0x4000, 0x4000, 0x4000ULL },
{ 0x7fffULL, 0x80, 0x4000, 0x4000, 0x4000ULL },
{ 0x8000ULL, 0, 0x8000, 0x8000, 0x8000ULL },
{ 0x8001ULL, 0x1, 0x8000, 0x8000, 0x8000ULL },
{ 0xfffeULL, 0x80, 0x8000, 0x8000, 0x8000ULL },
{ 0xffffULL, 0x80, 0x8000, 0x8000, 0x8000ULL },
{ 0x10000ULL, 0, 0, 0x10000, 0x10000ULL },
{ 0x10001ULL, 0x1, 0x1, 0x10000, 0x10000ULL },
{ 0xfedcba98ULL, 0x80, 0x8000, 0x80000000, 0x80000000ULL },
{ 0xfffffefeULL, 0x80, 0x8000, 0x80000000, 0x80000000ULL },
{ 0xffffffffULL, 0x80, 0x8000, 0x80000000, 0x80000000ULL },
{ 0x100000000ULL, 0, 0, 0, 0x100000000ULL },
{ 0x100000001ULL, 0x1, 0x1, 0x1, 0x100000000ULL },
{ 0x123456789ULL, 0x80, 0x4000, 0x20000000, 0x100000000ULL },
{ 0x123456789abcdefULL, 0x80, 0x8000, 0x80000000, 0x100000000000000ULL },
{ 0x789abcdef0123456ULL, 0x40, 0x2000, 0x80000000, 0x4000000000000000ULL },
{ 0x8000000000000000ULL, 0, 0, 0, 0x8000000000000000ULL },
{ 0x8000000000000001ULL, 0x1, 0x1, 0x1, 0x8000000000000000ULL },
{ 0xfffffffffffffffeULL, 0x80, 0x8000, 0x80000000, 0x8000000000000000ULL },
{ 0xffffffffffffffffULL, 0x80, 0x8000, 0x80000000, 0x8000000000000000ULL },
};
TEST_STDBIT_SAME_TOPLEVEL (stdc_bit_floor);
static int
do_test (void)
{
TEST_STDBIT_SAME (stdc_bit_floor, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_bit_width functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0, 0, 0, 0 },
{ 0x1ULL, 1, 1, 1, 1 },
{ 0x2ULL, 2, 2, 2, 2 },
{ 0x3ULL, 2, 2, 2, 2 },
{ 0x4ULL, 3, 3, 3, 3 },
{ 0x5ULL, 3, 3, 3, 3 },
{ 0x6ULL, 3, 3, 3, 3 },
{ 0x7ULL, 3, 3, 3, 3 },
{ 0x8ULL, 4, 4, 4, 4 },
{ 0x9ULL, 4, 4, 4, 4 },
{ 0xaULL, 4, 4, 4, 4 },
{ 0xbULL, 4, 4, 4, 4 },
{ 0xcULL, 4, 4, 4, 4 },
{ 0xdULL, 4, 4, 4, 4 },
{ 0xeULL, 4, 4, 4, 4 },
{ 0xfULL, 4, 4, 4, 4 },
{ 0x10ULL, 5, 5, 5, 5 },
{ 0x11ULL, 5, 5, 5, 5 },
{ 0x12ULL, 5, 5, 5, 5 },
{ 0x1fULL, 5, 5, 5, 5 },
{ 0x20ULL, 6, 6, 6, 6 },
{ 0x7fULL, 7, 7, 7, 7 },
{ 0x80ULL, 8, 8, 8, 8 },
{ 0x81ULL, 8, 8, 8, 8 },
{ 0x9aULL, 8, 8, 8, 8 },
{ 0xf3ULL, 8, 8, 8, 8 },
{ 0xffULL, 8, 8, 8, 8 },
{ 0x100ULL, 0, 9, 9, 9 },
{ 0x101ULL, 1, 9, 9, 9 },
{ 0x102ULL, 2, 9, 9, 9 },
{ 0x1feULL, 8, 9, 9, 9 },
{ 0x1ffULL, 8, 9, 9, 9 },
{ 0x200ULL, 0, 10, 10, 10 },
{ 0x234ULL, 6, 10, 10, 10 },
{ 0x4567ULL, 7, 15, 15, 15 },
{ 0x7fffULL, 8, 15, 15, 15 },
{ 0x8000ULL, 0, 16, 16, 16 },
{ 0x8001ULL, 1, 16, 16, 16 },
{ 0xfffeULL, 8, 16, 16, 16 },
{ 0xffffULL, 8, 16, 16, 16 },
{ 0x10000ULL, 0, 0, 17, 17 },
{ 0x10001ULL, 1, 1, 17, 17 },
{ 0xfedcba98ULL, 8, 16, 32, 32 },
{ 0xfffffefeULL, 8, 16, 32, 32 },
{ 0xffffffffULL, 8, 16, 32, 32 },
{ 0x100000000ULL, 0, 0, 0, 33 },
{ 0x100000001ULL, 1, 1, 1, 33 },
{ 0x123456789ULL, 8, 15, 30, 33 },
{ 0x123456789abcdefULL, 8, 16, 32, 57 },
{ 0x789abcdef0123456ULL, 7, 14, 32, 63 },
{ 0x8000000000000000ULL, 0, 0, 0, 64 },
{ 0x8000000000000001ULL, 1, 1, 1, 64 },
{ 0xfffffffffffffffeULL, 8, 16, 32, 64 },
{ 0xffffffffffffffffULL, 8, 16, 32, 64 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_bit_width);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_bit_width, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_count_ones functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0, 0, 0, 0 },
{ 0x1ULL, 1, 1, 1, 1 },
{ 0x2ULL, 1, 1, 1, 1 },
{ 0x3ULL, 2, 2, 2, 2 },
{ 0x4ULL, 1, 1, 1, 1 },
{ 0x5ULL, 2, 2, 2, 2 },
{ 0x6ULL, 2, 2, 2, 2 },
{ 0x7ULL, 3, 3, 3, 3 },
{ 0x8ULL, 1, 1, 1, 1 },
{ 0x9ULL, 2, 2, 2, 2 },
{ 0xaULL, 2, 2, 2, 2 },
{ 0xbULL, 3, 3, 3, 3 },
{ 0xcULL, 2, 2, 2, 2 },
{ 0xdULL, 3, 3, 3, 3 },
{ 0xeULL, 3, 3, 3, 3 },
{ 0xfULL, 4, 4, 4, 4 },
{ 0x10ULL, 1, 1, 1, 1 },
{ 0x11ULL, 2, 2, 2, 2 },
{ 0x12ULL, 2, 2, 2, 2 },
{ 0x1fULL, 5, 5, 5, 5 },
{ 0x20ULL, 1, 1, 1, 1 },
{ 0x7fULL, 7, 7, 7, 7 },
{ 0x80ULL, 1, 1, 1, 1 },
{ 0x81ULL, 2, 2, 2, 2 },
{ 0x9aULL, 4, 4, 4, 4 },
{ 0xf3ULL, 6, 6, 6, 6 },
{ 0xffULL, 8, 8, 8, 8 },
{ 0x100ULL, 0, 1, 1, 1 },
{ 0x101ULL, 1, 2, 2, 2 },
{ 0x102ULL, 1, 2, 2, 2 },
{ 0x1feULL, 7, 8, 8, 8 },
{ 0x1ffULL, 8, 9, 9, 9 },
{ 0x200ULL, 0, 1, 1, 1 },
{ 0x234ULL, 3, 4, 4, 4 },
{ 0x4567ULL, 5, 8, 8, 8 },
{ 0x7fffULL, 8, 15, 15, 15 },
{ 0x8000ULL, 0, 1, 1, 1 },
{ 0x8001ULL, 1, 2, 2, 2 },
{ 0xfffeULL, 7, 15, 15, 15 },
{ 0xffffULL, 8, 16, 16, 16 },
{ 0x10000ULL, 0, 0, 1, 1 },
{ 0x10001ULL, 1, 1, 2, 2 },
{ 0xfedcba98ULL, 3, 8, 20, 20 },
{ 0xfffffefeULL, 7, 14, 30, 30 },
{ 0xffffffffULL, 8, 16, 32, 32 },
{ 0x100000000ULL, 0, 0, 0, 1 },
{ 0x100000001ULL, 1, 1, 1, 2 },
{ 0x123456789ULL, 3, 8, 14, 15 },
{ 0x123456789abcdefULL, 7, 12, 20, 32 },
{ 0x789abcdef0123456ULL, 4, 7, 13, 32 },
{ 0x8000000000000000ULL, 0, 0, 0, 1 },
{ 0x8000000000000001ULL, 1, 1, 1, 2 },
{ 0xfffffffffffffffeULL, 7, 15, 31, 63 },
{ 0xffffffffffffffffULL, 8, 16, 32, 64 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_count_ones);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_count_ones, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_count_zeros functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 8, 16, 32, 64 },
{ 0x1ULL, 7, 15, 31, 63 },
{ 0x2ULL, 7, 15, 31, 63 },
{ 0x3ULL, 6, 14, 30, 62 },
{ 0x4ULL, 7, 15, 31, 63 },
{ 0x5ULL, 6, 14, 30, 62 },
{ 0x6ULL, 6, 14, 30, 62 },
{ 0x7ULL, 5, 13, 29, 61 },
{ 0x8ULL, 7, 15, 31, 63 },
{ 0x9ULL, 6, 14, 30, 62 },
{ 0xaULL, 6, 14, 30, 62 },
{ 0xbULL, 5, 13, 29, 61 },
{ 0xcULL, 6, 14, 30, 62 },
{ 0xdULL, 5, 13, 29, 61 },
{ 0xeULL, 5, 13, 29, 61 },
{ 0xfULL, 4, 12, 28, 60 },
{ 0x10ULL, 7, 15, 31, 63 },
{ 0x11ULL, 6, 14, 30, 62 },
{ 0x12ULL, 6, 14, 30, 62 },
{ 0x1fULL, 3, 11, 27, 59 },
{ 0x20ULL, 7, 15, 31, 63 },
{ 0x7fULL, 1, 9, 25, 57 },
{ 0x80ULL, 7, 15, 31, 63 },
{ 0x81ULL, 6, 14, 30, 62 },
{ 0x9aULL, 4, 12, 28, 60 },
{ 0xf3ULL, 2, 10, 26, 58 },
{ 0xffULL, 0, 8, 24, 56 },
{ 0x100ULL, 8, 15, 31, 63 },
{ 0x101ULL, 7, 14, 30, 62 },
{ 0x102ULL, 7, 14, 30, 62 },
{ 0x1feULL, 1, 8, 24, 56 },
{ 0x1ffULL, 0, 7, 23, 55 },
{ 0x200ULL, 8, 15, 31, 63 },
{ 0x234ULL, 5, 12, 28, 60 },
{ 0x4567ULL, 3, 8, 24, 56 },
{ 0x7fffULL, 0, 1, 17, 49 },
{ 0x8000ULL, 8, 15, 31, 63 },
{ 0x8001ULL, 7, 14, 30, 62 },
{ 0xfffeULL, 1, 1, 17, 49 },
{ 0xffffULL, 0, 0, 16, 48 },
{ 0x10000ULL, 8, 16, 31, 63 },
{ 0x10001ULL, 7, 15, 30, 62 },
{ 0xfedcba98ULL, 5, 8, 12, 44 },
{ 0xfffffefeULL, 1, 2, 2, 34 },
{ 0xffffffffULL, 0, 0, 0, 32 },
{ 0x100000000ULL, 8, 16, 32, 63 },
{ 0x100000001ULL, 7, 15, 31, 62 },
{ 0x123456789ULL, 5, 8, 18, 49 },
{ 0x123456789abcdefULL, 1, 4, 12, 32 },
{ 0x789abcdef0123456ULL, 4, 9, 19, 32 },
{ 0x8000000000000000ULL, 8, 16, 32, 63 },
{ 0x8000000000000001ULL, 7, 15, 31, 62 },
{ 0xfffffffffffffffeULL, 1, 1, 1, 1 },
{ 0xffffffffffffffffULL, 0, 0, 0, 0 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_count_zeros);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_count_zeros, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_first_leading_one functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0, 0, 0, 0 },
{ 0x1ULL, 8, 16, 32, 64 },
{ 0x2ULL, 7, 15, 31, 63 },
{ 0x3ULL, 7, 15, 31, 63 },
{ 0x4ULL, 6, 14, 30, 62 },
{ 0x5ULL, 6, 14, 30, 62 },
{ 0x6ULL, 6, 14, 30, 62 },
{ 0x7ULL, 6, 14, 30, 62 },
{ 0x8ULL, 5, 13, 29, 61 },
{ 0x9ULL, 5, 13, 29, 61 },
{ 0xaULL, 5, 13, 29, 61 },
{ 0xbULL, 5, 13, 29, 61 },
{ 0xcULL, 5, 13, 29, 61 },
{ 0xdULL, 5, 13, 29, 61 },
{ 0xeULL, 5, 13, 29, 61 },
{ 0xfULL, 5, 13, 29, 61 },
{ 0x10ULL, 4, 12, 28, 60 },
{ 0x11ULL, 4, 12, 28, 60 },
{ 0x12ULL, 4, 12, 28, 60 },
{ 0x1fULL, 4, 12, 28, 60 },
{ 0x20ULL, 3, 11, 27, 59 },
{ 0x7fULL, 2, 10, 26, 58 },
{ 0x80ULL, 1, 9, 25, 57 },
{ 0x81ULL, 1, 9, 25, 57 },
{ 0x9aULL, 1, 9, 25, 57 },
{ 0xf3ULL, 1, 9, 25, 57 },
{ 0xffULL, 1, 9, 25, 57 },
{ 0x100ULL, 0, 8, 24, 56 },
{ 0x101ULL, 8, 8, 24, 56 },
{ 0x102ULL, 7, 8, 24, 56 },
{ 0x1feULL, 1, 8, 24, 56 },
{ 0x1ffULL, 1, 8, 24, 56 },
{ 0x200ULL, 0, 7, 23, 55 },
{ 0x234ULL, 3, 7, 23, 55 },
{ 0x4567ULL, 2, 2, 18, 50 },
{ 0x7fffULL, 1, 2, 18, 50 },
{ 0x8000ULL, 0, 1, 17, 49 },
{ 0x8001ULL, 8, 1, 17, 49 },
{ 0xfffeULL, 1, 1, 17, 49 },
{ 0xffffULL, 1, 1, 17, 49 },
{ 0x10000ULL, 0, 0, 16, 48 },
{ 0x10001ULL, 8, 16, 16, 48 },
{ 0xfedcba98ULL, 1, 1, 1, 33 },
{ 0xfffffefeULL, 1, 1, 1, 33 },
{ 0xffffffffULL, 1, 1, 1, 33 },
{ 0x100000000ULL, 0, 0, 0, 32 },
{ 0x100000001ULL, 8, 16, 32, 32 },
{ 0x123456789ULL, 1, 2, 3, 32 },
{ 0x123456789abcdefULL, 1, 1, 1, 8 },
{ 0x789abcdef0123456ULL, 2, 3, 1, 2 },
{ 0x8000000000000000ULL, 0, 0, 0, 1 },
{ 0x8000000000000001ULL, 8, 16, 32, 1 },
{ 0xfffffffffffffffeULL, 1, 1, 1, 1 },
{ 0xffffffffffffffffULL, 1, 1, 1, 1 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_first_leading_one);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_first_leading_one, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_first_leading_zero functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 1, 1, 1, 1 },
{ 0x1ULL, 1, 1, 1, 1 },
{ 0x2ULL, 1, 1, 1, 1 },
{ 0x3ULL, 1, 1, 1, 1 },
{ 0x4ULL, 1, 1, 1, 1 },
{ 0x5ULL, 1, 1, 1, 1 },
{ 0x6ULL, 1, 1, 1, 1 },
{ 0x7ULL, 1, 1, 1, 1 },
{ 0x8ULL, 1, 1, 1, 1 },
{ 0x9ULL, 1, 1, 1, 1 },
{ 0xaULL, 1, 1, 1, 1 },
{ 0xbULL, 1, 1, 1, 1 },
{ 0xcULL, 1, 1, 1, 1 },
{ 0xdULL, 1, 1, 1, 1 },
{ 0xeULL, 1, 1, 1, 1 },
{ 0xfULL, 1, 1, 1, 1 },
{ 0x10ULL, 1, 1, 1, 1 },
{ 0x11ULL, 1, 1, 1, 1 },
{ 0x12ULL, 1, 1, 1, 1 },
{ 0x1fULL, 1, 1, 1, 1 },
{ 0x20ULL, 1, 1, 1, 1 },
{ 0x7fULL, 1, 1, 1, 1 },
{ 0x80ULL, 2, 1, 1, 1 },
{ 0x81ULL, 2, 1, 1, 1 },
{ 0x9aULL, 2, 1, 1, 1 },
{ 0xf3ULL, 5, 1, 1, 1 },
{ 0xffULL, 0, 1, 1, 1 },
{ 0x100ULL, 1, 1, 1, 1 },
{ 0x101ULL, 1, 1, 1, 1 },
{ 0x102ULL, 1, 1, 1, 1 },
{ 0x1feULL, 8, 1, 1, 1 },
{ 0x1ffULL, 0, 1, 1, 1 },
{ 0x200ULL, 1, 1, 1, 1 },
{ 0x234ULL, 1, 1, 1, 1 },
{ 0x4567ULL, 1, 1, 1, 1 },
{ 0x7fffULL, 0, 1, 1, 1 },
{ 0x8000ULL, 1, 2, 1, 1 },
{ 0x8001ULL, 1, 2, 1, 1 },
{ 0xfffeULL, 8, 16, 1, 1 },
{ 0xffffULL, 0, 0, 1, 1 },
{ 0x10000ULL, 1, 1, 1, 1 },
{ 0x10001ULL, 1, 1, 1, 1 },
{ 0xfedcba98ULL, 2, 2, 8, 1 },
{ 0xfffffefeULL, 8, 8, 24, 1 },
{ 0xffffffffULL, 0, 0, 0, 1 },
{ 0x100000000ULL, 1, 1, 1, 1 },
{ 0x100000001ULL, 1, 1, 1, 1 },
{ 0x123456789ULL, 2, 1, 1, 1 },
{ 0x123456789abcdefULL, 4, 3, 2, 1 },
{ 0x789abcdef0123456ULL, 1, 1, 5, 1 },
{ 0x8000000000000000ULL, 1, 1, 1, 2 },
{ 0x8000000000000001ULL, 1, 1, 1, 2 },
{ 0xfffffffffffffffeULL, 8, 16, 32, 64 },
{ 0xffffffffffffffffULL, 0, 0, 0, 0 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_first_leading_zero);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_first_leading_zero, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_first_trailing_one functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0, 0, 0, 0 },
{ 0x1ULL, 1, 1, 1, 1 },
{ 0x2ULL, 2, 2, 2, 2 },
{ 0x3ULL, 1, 1, 1, 1 },
{ 0x4ULL, 3, 3, 3, 3 },
{ 0x5ULL, 1, 1, 1, 1 },
{ 0x6ULL, 2, 2, 2, 2 },
{ 0x7ULL, 1, 1, 1, 1 },
{ 0x8ULL, 4, 4, 4, 4 },
{ 0x9ULL, 1, 1, 1, 1 },
{ 0xaULL, 2, 2, 2, 2 },
{ 0xbULL, 1, 1, 1, 1 },
{ 0xcULL, 3, 3, 3, 3 },
{ 0xdULL, 1, 1, 1, 1 },
{ 0xeULL, 2, 2, 2, 2 },
{ 0xfULL, 1, 1, 1, 1 },
{ 0x10ULL, 5, 5, 5, 5 },
{ 0x11ULL, 1, 1, 1, 1 },
{ 0x12ULL, 2, 2, 2, 2 },
{ 0x1fULL, 1, 1, 1, 1 },
{ 0x20ULL, 6, 6, 6, 6 },
{ 0x7fULL, 1, 1, 1, 1 },
{ 0x80ULL, 8, 8, 8, 8 },
{ 0x81ULL, 1, 1, 1, 1 },
{ 0x9aULL, 2, 2, 2, 2 },
{ 0xf3ULL, 1, 1, 1, 1 },
{ 0xffULL, 1, 1, 1, 1 },
{ 0x100ULL, 0, 9, 9, 9 },
{ 0x101ULL, 1, 1, 1, 1 },
{ 0x102ULL, 2, 2, 2, 2 },
{ 0x1feULL, 2, 2, 2, 2 },
{ 0x1ffULL, 1, 1, 1, 1 },
{ 0x200ULL, 0, 10, 10, 10 },
{ 0x234ULL, 3, 3, 3, 3 },
{ 0x4567ULL, 1, 1, 1, 1 },
{ 0x7fffULL, 1, 1, 1, 1 },
{ 0x8000ULL, 0, 16, 16, 16 },
{ 0x8001ULL, 1, 1, 1, 1 },
{ 0xfffeULL, 2, 2, 2, 2 },
{ 0xffffULL, 1, 1, 1, 1 },
{ 0x10000ULL, 0, 0, 17, 17 },
{ 0x10001ULL, 1, 1, 1, 1 },
{ 0xfedcba98ULL, 4, 4, 4, 4 },
{ 0xfffffefeULL, 2, 2, 2, 2 },
{ 0xffffffffULL, 1, 1, 1, 1 },
{ 0x100000000ULL, 0, 0, 0, 33 },
{ 0x100000001ULL, 1, 1, 1, 1 },
{ 0x123456789ULL, 1, 1, 1, 1 },
{ 0x123456789abcdefULL, 1, 1, 1, 1 },
{ 0x789abcdef0123456ULL, 2, 2, 2, 2 },
{ 0x8000000000000000ULL, 0, 0, 0, 64 },
{ 0x8000000000000001ULL, 1, 1, 1, 1 },
{ 0xfffffffffffffffeULL, 2, 2, 2, 2 },
{ 0xffffffffffffffffULL, 1, 1, 1, 1 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_first_trailing_one);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_first_trailing_one, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_first_trailing_zero functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 1, 1, 1, 1 },
{ 0x1ULL, 2, 2, 2, 2 },
{ 0x2ULL, 1, 1, 1, 1 },
{ 0x3ULL, 3, 3, 3, 3 },
{ 0x4ULL, 1, 1, 1, 1 },
{ 0x5ULL, 2, 2, 2, 2 },
{ 0x6ULL, 1, 1, 1, 1 },
{ 0x7ULL, 4, 4, 4, 4 },
{ 0x8ULL, 1, 1, 1, 1 },
{ 0x9ULL, 2, 2, 2, 2 },
{ 0xaULL, 1, 1, 1, 1 },
{ 0xbULL, 3, 3, 3, 3 },
{ 0xcULL, 1, 1, 1, 1 },
{ 0xdULL, 2, 2, 2, 2 },
{ 0xeULL, 1, 1, 1, 1 },
{ 0xfULL, 5, 5, 5, 5 },
{ 0x10ULL, 1, 1, 1, 1 },
{ 0x11ULL, 2, 2, 2, 2 },
{ 0x12ULL, 1, 1, 1, 1 },
{ 0x1fULL, 6, 6, 6, 6 },
{ 0x20ULL, 1, 1, 1, 1 },
{ 0x7fULL, 8, 8, 8, 8 },
{ 0x80ULL, 1, 1, 1, 1 },
{ 0x81ULL, 2, 2, 2, 2 },
{ 0x9aULL, 1, 1, 1, 1 },
{ 0xf3ULL, 3, 3, 3, 3 },
{ 0xffULL, 0, 9, 9, 9 },
{ 0x100ULL, 1, 1, 1, 1 },
{ 0x101ULL, 2, 2, 2, 2 },
{ 0x102ULL, 1, 1, 1, 1 },
{ 0x1feULL, 1, 1, 1, 1 },
{ 0x1ffULL, 0, 10, 10, 10 },
{ 0x200ULL, 1, 1, 1, 1 },
{ 0x234ULL, 1, 1, 1, 1 },
{ 0x4567ULL, 4, 4, 4, 4 },
{ 0x7fffULL, 0, 16, 16, 16 },
{ 0x8000ULL, 1, 1, 1, 1 },
{ 0x8001ULL, 2, 2, 2, 2 },
{ 0xfffeULL, 1, 1, 1, 1 },
{ 0xffffULL, 0, 0, 17, 17 },
{ 0x10000ULL, 1, 1, 1, 1 },
{ 0x10001ULL, 2, 2, 2, 2 },
{ 0xfedcba98ULL, 1, 1, 1, 1 },
{ 0xfffffefeULL, 1, 1, 1, 1 },
{ 0xffffffffULL, 0, 0, 0, 33 },
{ 0x100000000ULL, 1, 1, 1, 1 },
{ 0x100000001ULL, 2, 2, 2, 2 },
{ 0x123456789ULL, 2, 2, 2, 2 },
{ 0x123456789abcdefULL, 5, 5, 5, 5 },
{ 0x789abcdef0123456ULL, 1, 1, 1, 1 },
{ 0x8000000000000000ULL, 1, 1, 1, 1 },
{ 0x8000000000000001ULL, 2, 2, 2, 2 },
{ 0xfffffffffffffffeULL, 1, 1, 1, 1 },
{ 0xffffffffffffffffULL, 0, 0, 0, 0 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_first_trailing_zero);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_first_trailing_zero, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_has_single_bit functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, false, false, false, false },
{ 0x1ULL, true, true, true, true },
{ 0x2ULL, true, true, true, true },
{ 0x3ULL, false, false, false, false },
{ 0x4ULL, true, true, true, true },
{ 0x5ULL, false, false, false, false },
{ 0x6ULL, false, false, false, false },
{ 0x7ULL, false, false, false, false },
{ 0x8ULL, true, true, true, true },
{ 0x9ULL, false, false, false, false },
{ 0xaULL, false, false, false, false },
{ 0xbULL, false, false, false, false },
{ 0xcULL, false, false, false, false },
{ 0xdULL, false, false, false, false },
{ 0xeULL, false, false, false, false },
{ 0xfULL, false, false, false, false },
{ 0x10ULL, true, true, true, true },
{ 0x11ULL, false, false, false, false },
{ 0x12ULL, false, false, false, false },
{ 0x1fULL, false, false, false, false },
{ 0x20ULL, true, true, true, true },
{ 0x7fULL, false, false, false, false },
{ 0x80ULL, true, true, true, true },
{ 0x81ULL, false, false, false, false },
{ 0x9aULL, false, false, false, false },
{ 0xf3ULL, false, false, false, false },
{ 0xffULL, false, false, false, false },
{ 0x100ULL, false, true, true, true },
{ 0x101ULL, true, false, false, false },
{ 0x102ULL, true, false, false, false },
{ 0x1feULL, false, false, false, false },
{ 0x1ffULL, false, false, false, false },
{ 0x200ULL, false, true, true, true },
{ 0x234ULL, false, false, false, false },
{ 0x4567ULL, false, false, false, false },
{ 0x7fffULL, false, false, false, false },
{ 0x8000ULL, false, true, true, true },
{ 0x8001ULL, true, false, false, false },
{ 0xfffeULL, false, false, false, false },
{ 0xffffULL, false, false, false, false },
{ 0x10000ULL, false, false, true, true },
{ 0x10001ULL, true, true, false, false },
{ 0xfedcba98ULL, false, false, false, false },
{ 0xfffffefeULL, false, false, false, false },
{ 0xffffffffULL, false, false, false, false },
{ 0x100000000ULL, false, false, false, true },
{ 0x100000001ULL, true, true, true, false },
{ 0x123456789ULL, false, false, false, false },
{ 0x123456789abcdefULL, false, false, false, false },
{ 0x789abcdef0123456ULL, false, false, false, false },
{ 0x8000000000000000ULL, false, false, false, true },
{ 0x8000000000000001ULL, true, true, true, false },
{ 0xfffffffffffffffeULL, false, false, false, false },
{ 0xffffffffffffffffULL, false, false, false, false },
};
TEST_STDBIT_BOOL_TOPLEVEL (stdc_has_single_bit);
static int
do_test (void)
{
TEST_STDBIT_BOOL (stdc_has_single_bit, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_leading_ones functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0, 0, 0, 0 },
{ 0x1ULL, 0, 0, 0, 0 },
{ 0x2ULL, 0, 0, 0, 0 },
{ 0x3ULL, 0, 0, 0, 0 },
{ 0x4ULL, 0, 0, 0, 0 },
{ 0x5ULL, 0, 0, 0, 0 },
{ 0x6ULL, 0, 0, 0, 0 },
{ 0x7ULL, 0, 0, 0, 0 },
{ 0x8ULL, 0, 0, 0, 0 },
{ 0x9ULL, 0, 0, 0, 0 },
{ 0xaULL, 0, 0, 0, 0 },
{ 0xbULL, 0, 0, 0, 0 },
{ 0xcULL, 0, 0, 0, 0 },
{ 0xdULL, 0, 0, 0, 0 },
{ 0xeULL, 0, 0, 0, 0 },
{ 0xfULL, 0, 0, 0, 0 },
{ 0x10ULL, 0, 0, 0, 0 },
{ 0x11ULL, 0, 0, 0, 0 },
{ 0x12ULL, 0, 0, 0, 0 },
{ 0x1fULL, 0, 0, 0, 0 },
{ 0x20ULL, 0, 0, 0, 0 },
{ 0x7fULL, 0, 0, 0, 0 },
{ 0x80ULL, 1, 0, 0, 0 },
{ 0x81ULL, 1, 0, 0, 0 },
{ 0x9aULL, 1, 0, 0, 0 },
{ 0xf3ULL, 4, 0, 0, 0 },
{ 0xffULL, 8, 0, 0, 0 },
{ 0x100ULL, 0, 0, 0, 0 },
{ 0x101ULL, 0, 0, 0, 0 },
{ 0x102ULL, 0, 0, 0, 0 },
{ 0x1feULL, 7, 0, 0, 0 },
{ 0x1ffULL, 8, 0, 0, 0 },
{ 0x200ULL, 0, 0, 0, 0 },
{ 0x234ULL, 0, 0, 0, 0 },
{ 0x4567ULL, 0, 0, 0, 0 },
{ 0x7fffULL, 8, 0, 0, 0 },
{ 0x8000ULL, 0, 1, 0, 0 },
{ 0x8001ULL, 0, 1, 0, 0 },
{ 0xfffeULL, 7, 15, 0, 0 },
{ 0xffffULL, 8, 16, 0, 0 },
{ 0x10000ULL, 0, 0, 0, 0 },
{ 0x10001ULL, 0, 0, 0, 0 },
{ 0xfedcba98ULL, 1, 1, 7, 0 },
{ 0xfffffefeULL, 7, 7, 23, 0 },
{ 0xffffffffULL, 8, 16, 32, 0 },
{ 0x100000000ULL, 0, 0, 0, 0 },
{ 0x100000001ULL, 0, 0, 0, 0 },
{ 0x123456789ULL, 1, 0, 0, 0 },
{ 0x123456789abcdefULL, 3, 2, 1, 0 },
{ 0x789abcdef0123456ULL, 0, 0, 4, 0 },
{ 0x8000000000000000ULL, 0, 0, 0, 1 },
{ 0x8000000000000001ULL, 0, 0, 0, 1 },
{ 0xfffffffffffffffeULL, 7, 15, 31, 63 },
{ 0xffffffffffffffffULL, 8, 16, 32, 64 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_leading_ones);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_leading_ones, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_leading_zeros functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 8, 16, 32, 64 },
{ 0x1ULL, 7, 15, 31, 63 },
{ 0x2ULL, 6, 14, 30, 62 },
{ 0x3ULL, 6, 14, 30, 62 },
{ 0x4ULL, 5, 13, 29, 61 },
{ 0x5ULL, 5, 13, 29, 61 },
{ 0x6ULL, 5, 13, 29, 61 },
{ 0x7ULL, 5, 13, 29, 61 },
{ 0x8ULL, 4, 12, 28, 60 },
{ 0x9ULL, 4, 12, 28, 60 },
{ 0xaULL, 4, 12, 28, 60 },
{ 0xbULL, 4, 12, 28, 60 },
{ 0xcULL, 4, 12, 28, 60 },
{ 0xdULL, 4, 12, 28, 60 },
{ 0xeULL, 4, 12, 28, 60 },
{ 0xfULL, 4, 12, 28, 60 },
{ 0x10ULL, 3, 11, 27, 59 },
{ 0x11ULL, 3, 11, 27, 59 },
{ 0x12ULL, 3, 11, 27, 59 },
{ 0x1fULL, 3, 11, 27, 59 },
{ 0x20ULL, 2, 10, 26, 58 },
{ 0x7fULL, 1, 9, 25, 57 },
{ 0x80ULL, 0, 8, 24, 56 },
{ 0x81ULL, 0, 8, 24, 56 },
{ 0x9aULL, 0, 8, 24, 56 },
{ 0xf3ULL, 0, 8, 24, 56 },
{ 0xffULL, 0, 8, 24, 56 },
{ 0x100ULL, 8, 7, 23, 55 },
{ 0x101ULL, 7, 7, 23, 55 },
{ 0x102ULL, 6, 7, 23, 55 },
{ 0x1feULL, 0, 7, 23, 55 },
{ 0x1ffULL, 0, 7, 23, 55 },
{ 0x200ULL, 8, 6, 22, 54 },
{ 0x234ULL, 2, 6, 22, 54 },
{ 0x4567ULL, 1, 1, 17, 49 },
{ 0x7fffULL, 0, 1, 17, 49 },
{ 0x8000ULL, 8, 0, 16, 48 },
{ 0x8001ULL, 7, 0, 16, 48 },
{ 0xfffeULL, 0, 0, 16, 48 },
{ 0xffffULL, 0, 0, 16, 48 },
{ 0x10000ULL, 8, 16, 15, 47 },
{ 0x10001ULL, 7, 15, 15, 47 },
{ 0xfedcba98ULL, 0, 0, 0, 32 },
{ 0xfffffefeULL, 0, 0, 0, 32 },
{ 0xffffffffULL, 0, 0, 0, 32 },
{ 0x100000000ULL, 8, 16, 32, 31 },
{ 0x100000001ULL, 7, 15, 31, 31 },
{ 0x123456789ULL, 0, 1, 2, 31 },
{ 0x123456789abcdefULL, 0, 0, 0, 7 },
{ 0x789abcdef0123456ULL, 1, 2, 0, 1 },
{ 0x8000000000000000ULL, 8, 16, 32, 0 },
{ 0x8000000000000001ULL, 7, 15, 31, 0 },
{ 0xfffffffffffffffeULL, 0, 0, 0, 0 },
{ 0xffffffffffffffffULL, 0, 0, 0, 0 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_leading_zeros);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_leading_zeros, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_trailing_ones functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 0, 0, 0, 0 },
{ 0x1ULL, 1, 1, 1, 1 },
{ 0x2ULL, 0, 0, 0, 0 },
{ 0x3ULL, 2, 2, 2, 2 },
{ 0x4ULL, 0, 0, 0, 0 },
{ 0x5ULL, 1, 1, 1, 1 },
{ 0x6ULL, 0, 0, 0, 0 },
{ 0x7ULL, 3, 3, 3, 3 },
{ 0x8ULL, 0, 0, 0, 0 },
{ 0x9ULL, 1, 1, 1, 1 },
{ 0xaULL, 0, 0, 0, 0 },
{ 0xbULL, 2, 2, 2, 2 },
{ 0xcULL, 0, 0, 0, 0 },
{ 0xdULL, 1, 1, 1, 1 },
{ 0xeULL, 0, 0, 0, 0 },
{ 0xfULL, 4, 4, 4, 4 },
{ 0x10ULL, 0, 0, 0, 0 },
{ 0x11ULL, 1, 1, 1, 1 },
{ 0x12ULL, 0, 0, 0, 0 },
{ 0x1fULL, 5, 5, 5, 5 },
{ 0x20ULL, 0, 0, 0, 0 },
{ 0x7fULL, 7, 7, 7, 7 },
{ 0x80ULL, 0, 0, 0, 0 },
{ 0x81ULL, 1, 1, 1, 1 },
{ 0x9aULL, 0, 0, 0, 0 },
{ 0xf3ULL, 2, 2, 2, 2 },
{ 0xffULL, 8, 8, 8, 8 },
{ 0x100ULL, 0, 0, 0, 0 },
{ 0x101ULL, 1, 1, 1, 1 },
{ 0x102ULL, 0, 0, 0, 0 },
{ 0x1feULL, 0, 0, 0, 0 },
{ 0x1ffULL, 8, 9, 9, 9 },
{ 0x200ULL, 0, 0, 0, 0 },
{ 0x234ULL, 0, 0, 0, 0 },
{ 0x4567ULL, 3, 3, 3, 3 },
{ 0x7fffULL, 8, 15, 15, 15 },
{ 0x8000ULL, 0, 0, 0, 0 },
{ 0x8001ULL, 1, 1, 1, 1 },
{ 0xfffeULL, 0, 0, 0, 0 },
{ 0xffffULL, 8, 16, 16, 16 },
{ 0x10000ULL, 0, 0, 0, 0 },
{ 0x10001ULL, 1, 1, 1, 1 },
{ 0xfedcba98ULL, 0, 0, 0, 0 },
{ 0xfffffefeULL, 0, 0, 0, 0 },
{ 0xffffffffULL, 8, 16, 32, 32 },
{ 0x100000000ULL, 0, 0, 0, 0 },
{ 0x100000001ULL, 1, 1, 1, 1 },
{ 0x123456789ULL, 1, 1, 1, 1 },
{ 0x123456789abcdefULL, 4, 4, 4, 4 },
{ 0x789abcdef0123456ULL, 0, 0, 0, 0 },
{ 0x8000000000000000ULL, 0, 0, 0, 0 },
{ 0x8000000000000001ULL, 1, 1, 1, 1 },
{ 0xfffffffffffffffeULL, 0, 0, 0, 0 },
{ 0xffffffffffffffffULL, 8, 16, 32, 64 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_trailing_ones);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_trailing_ones, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -0,0 +1,88 @@
/* Test stdc_trailing_zeros functions and macros.
Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <tst-stdbit.h>
static const struct stdbit_test inputs[] =
{
{ 0ULL, 8, 16, 32, 64 },
{ 0x1ULL, 0, 0, 0, 0 },
{ 0x2ULL, 1, 1, 1, 1 },
{ 0x3ULL, 0, 0, 0, 0 },
{ 0x4ULL, 2, 2, 2, 2 },
{ 0x5ULL, 0, 0, 0, 0 },
{ 0x6ULL, 1, 1, 1, 1 },
{ 0x7ULL, 0, 0, 0, 0 },
{ 0x8ULL, 3, 3, 3, 3 },
{ 0x9ULL, 0, 0, 0, 0 },
{ 0xaULL, 1, 1, 1, 1 },
{ 0xbULL, 0, 0, 0, 0 },
{ 0xcULL, 2, 2, 2, 2 },
{ 0xdULL, 0, 0, 0, 0 },
{ 0xeULL, 1, 1, 1, 1 },
{ 0xfULL, 0, 0, 0, 0 },
{ 0x10ULL, 4, 4, 4, 4 },
{ 0x11ULL, 0, 0, 0, 0 },
{ 0x12ULL, 1, 1, 1, 1 },
{ 0x1fULL, 0, 0, 0, 0 },
{ 0x20ULL, 5, 5, 5, 5 },
{ 0x7fULL, 0, 0, 0, 0 },
{ 0x80ULL, 7, 7, 7, 7 },
{ 0x81ULL, 0, 0, 0, 0 },
{ 0x9aULL, 1, 1, 1, 1 },
{ 0xf3ULL, 0, 0, 0, 0 },
{ 0xffULL, 0, 0, 0, 0 },
{ 0x100ULL, 8, 8, 8, 8 },
{ 0x101ULL, 0, 0, 0, 0 },
{ 0x102ULL, 1, 1, 1, 1 },
{ 0x1feULL, 1, 1, 1, 1 },
{ 0x1ffULL, 0, 0, 0, 0 },
{ 0x200ULL, 8, 9, 9, 9 },
{ 0x234ULL, 2, 2, 2, 2 },
{ 0x4567ULL, 0, 0, 0, 0 },
{ 0x7fffULL, 0, 0, 0, 0 },
{ 0x8000ULL, 8, 15, 15, 15 },
{ 0x8001ULL, 0, 0, 0, 0 },
{ 0xfffeULL, 1, 1, 1, 1 },
{ 0xffffULL, 0, 0, 0, 0 },
{ 0x10000ULL, 8, 16, 16, 16 },
{ 0x10001ULL, 0, 0, 0, 0 },
{ 0xfedcba98ULL, 3, 3, 3, 3 },
{ 0xfffffefeULL, 1, 1, 1, 1 },
{ 0xffffffffULL, 0, 0, 0, 0 },
{ 0x100000000ULL, 8, 16, 32, 32 },
{ 0x100000001ULL, 0, 0, 0, 0 },
{ 0x123456789ULL, 0, 0, 0, 0 },
{ 0x123456789abcdefULL, 0, 0, 0, 0 },
{ 0x789abcdef0123456ULL, 1, 1, 1, 1 },
{ 0x8000000000000000ULL, 8, 16, 32, 63 },
{ 0x8000000000000001ULL, 0, 0, 0, 0 },
{ 0xfffffffffffffffeULL, 1, 1, 1, 1 },
{ 0xffffffffffffffffULL, 0, 0, 0, 0 },
};
TEST_STDBIT_UI_TOPLEVEL (stdc_trailing_zeros);
static int
do_test (void)
{
TEST_STDBIT_UI (stdc_trailing_zeros, inputs);
return 0;
}
#include <support/test-driver.c>

View File

@ -2334,6 +2334,76 @@ GLIBC_2.38 strlcat F
GLIBC_2.38 strlcpy F
GLIBC_2.38 wcslcat F
GLIBC_2.38 wcslcpy F
GLIBC_2.39 stdc_bit_ceil_uc F
GLIBC_2.39 stdc_bit_ceil_ui F
GLIBC_2.39 stdc_bit_ceil_ul F
GLIBC_2.39 stdc_bit_ceil_ull F
GLIBC_2.39 stdc_bit_ceil_us F
GLIBC_2.39 stdc_bit_floor_uc F
GLIBC_2.39 stdc_bit_floor_ui F
GLIBC_2.39 stdc_bit_floor_ul F
GLIBC_2.39 stdc_bit_floor_ull F
GLIBC_2.39 stdc_bit_floor_us F
GLIBC_2.39 stdc_bit_width_uc F
GLIBC_2.39 stdc_bit_width_ui F
GLIBC_2.39 stdc_bit_width_ul F
GLIBC_2.39 stdc_bit_width_ull F
GLIBC_2.39 stdc_bit_width_us F
GLIBC_2.39 stdc_count_ones_uc F
GLIBC_2.39 stdc_count_ones_ui F
GLIBC_2.39 stdc_count_ones_ul F
GLIBC_2.39 stdc_count_ones_ull F
GLIBC_2.39 stdc_count_ones_us F
GLIBC_2.39 stdc_count_zeros_uc F
GLIBC_2.39 stdc_count_zeros_ui F
GLIBC_2.39 stdc_count_zeros_ul F
GLIBC_2.39 stdc_count_zeros_ull F
GLIBC_2.39 stdc_count_zeros_us F
GLIBC_2.39 stdc_first_leading_one_uc F
GLIBC_2.39 stdc_first_leading_one_ui F
GLIBC_2.39 stdc_first_leading_one_ul F
GLIBC_2.39 stdc_first_leading_one_ull F
GLIBC_2.39 stdc_first_leading_one_us F
GLIBC_2.39 stdc_first_leading_zero_uc F
GLIBC_2.39 stdc_first_leading_zero_ui F
GLIBC_2.39 stdc_first_leading_zero_ul F
GLIBC_2.39 stdc_first_leading_zero_ull F
GLIBC_2.39 stdc_first_leading_zero_us F
GLIBC_2.39 stdc_first_trailing_one_uc F
GLIBC_2.39 stdc_first_trailing_one_ui F
GLIBC_2.39 stdc_first_trailing_one_ul F
GLIBC_2.39 stdc_first_trailing_one_ull F
GLIBC_2.39 stdc_first_trailing_one_us F
GLIBC_2.39 stdc_first_trailing_zero_uc F
GLIBC_2.39 stdc_first_trailing_zero_ui F
GLIBC_2.39 stdc_first_trailing_zero_ul F
GLIBC_2.39 stdc_first_trailing_zero_ull F
GLIBC_2.39 stdc_first_trailing_zero_us F
GLIBC_2.39 stdc_has_single_bit_uc F
GLIBC_2.39 stdc_has_single_bit_ui F
GLIBC_2.39 stdc_has_single_bit_ul F
GLIBC_2.39 stdc_has_single_bit_ull F
GLIBC_2.39 stdc_has_single_bit_us F
GLIBC_2.39 stdc_leading_ones_uc F
GLIBC_2.39 stdc_leading_ones_ui F
GLIBC_2.39 stdc_leading_ones_ul F
GLIBC_2.39 stdc_leading_ones_ull F
GLIBC_2.39 stdc_leading_ones_us F
GLIBC_2.39 stdc_leading_zeros_uc F
GLIBC_2.39 stdc_leading_zeros_ui F
GLIBC_2.39 stdc_leading_zeros_ul F
GLIBC_2.39 stdc_leading_zeros_ull F
GLIBC_2.39 stdc_leading_zeros_us F
GLIBC_2.39 stdc_trailing_ones_uc F
GLIBC_2.39 stdc_trailing_ones_ui F
GLIBC_2.39 stdc_trailing_ones_ul F
GLIBC_2.39 stdc_trailing_ones_ull F
GLIBC_2.39 stdc_trailing_ones_us F
GLIBC_2.39 stdc_trailing_zeros_uc F
GLIBC_2.39 stdc_trailing_zeros_ui F
GLIBC_2.39 stdc_trailing_zeros_ul F
GLIBC_2.39 stdc_trailing_zeros_ull F
GLIBC_2.39 stdc_trailing_zeros_us F
GLIBC_2.4 __confstr_chk F
GLIBC_2.4 __fgets_chk F
GLIBC_2.4 __fgets_unlocked_chk F

View File

@ -2114,6 +2114,76 @@ GLIBC_2.38 wprintf F
GLIBC_2.38 write F
GLIBC_2.38 writev F
GLIBC_2.38 wscanf F
GLIBC_2.39 stdc_bit_ceil_uc F
GLIBC_2.39 stdc_bit_ceil_ui F
GLIBC_2.39 stdc_bit_ceil_ul F
GLIBC_2.39 stdc_bit_ceil_ull F
GLIBC_2.39 stdc_bit_ceil_us F
GLIBC_2.39 stdc_bit_floor_uc F
GLIBC_2.39 stdc_bit_floor_ui F
GLIBC_2.39 stdc_bit_floor_ul F
GLIBC_2.39 stdc_bit_floor_ull F
GLIBC_2.39 stdc_bit_floor_us F
GLIBC_2.39 stdc_bit_width_uc F
GLIBC_2.39 stdc_bit_width_ui F
GLIBC_2.39 stdc_bit_width_ul F
GLIBC_2.39 stdc_bit_width_ull F
GLIBC_2.39 stdc_bit_width_us F
GLIBC_2.39 stdc_count_ones_uc F
GLIBC_2.39 stdc_count_ones_ui F
GLIBC_2.39 stdc_count_ones_ul F
GLIBC_2.39 stdc_count_ones_ull F
GLIBC_2.39 stdc_count_ones_us F
GLIBC_2.39 stdc_count_zeros_uc F
GLIBC_2.39 stdc_count_zeros_ui F
GLIBC_2.39 stdc_count_zeros_ul F
GLIBC_2.39 stdc_count_zeros_ull F
GLIBC_2.39 stdc_count_zeros_us F
GLIBC_2.39 stdc_first_leading_one_uc F
GLIBC_2.39 stdc_first_leading_one_ui F
GLIBC_2.39 stdc_first_leading_one_ul F
GLIBC_2.39 stdc_first_leading_one_ull F
GLIBC_2.39 stdc_first_leading_one_us F
GLIBC_2.39 stdc_first_leading_zero_uc F
GLIBC_2.39 stdc_first_leading_zero_ui F
GLIBC_2.39 stdc_first_leading_zero_ul F
GLIBC_2.39 stdc_first_leading_zero_ull F
GLIBC_2.39 stdc_first_leading_zero_us F
GLIBC_2.39 stdc_first_trailing_one_uc F
GLIBC_2.39 stdc_first_trailing_one_ui F
GLIBC_2.39 stdc_first_trailing_one_ul F
GLIBC_2.39 stdc_first_trailing_one_ull F
GLIBC_2.39 stdc_first_trailing_one_us F
GLIBC_2.39 stdc_first_trailing_zero_uc F
GLIBC_2.39 stdc_first_trailing_zero_ui F
GLIBC_2.39 stdc_first_trailing_zero_ul F
GLIBC_2.39 stdc_first_trailing_zero_ull F
GLIBC_2.39 stdc_first_trailing_zero_us F
GLIBC_2.39 stdc_has_single_bit_uc F
GLIBC_2.39 stdc_has_single_bit_ui F
GLIBC_2.39 stdc_has_single_bit_ul F
GLIBC_2.39 stdc_has_single_bit_ull F
GLIBC_2.39 stdc_has_single_bit_us F
GLIBC_2.39 stdc_leading_ones_uc F
GLIBC_2.39 stdc_leading_ones_ui F
GLIBC_2.39 stdc_leading_ones_ul F
GLIBC_2.39 stdc_leading_ones_ull F
GLIBC_2.39 stdc_leading_ones_us F
GLIBC_2.39 stdc_leading_zeros_uc F
GLIBC_2.39 stdc_leading_zeros_ui F
GLIBC_2.39 stdc_leading_zeros_ul F
GLIBC_2.39 stdc_leading_zeros_ull F
GLIBC_2.39 stdc_leading_zeros_us F
GLIBC_2.39 stdc_trailing_ones_uc F
GLIBC_2.39 stdc_trailing_ones_ui F
GLIBC_2.39 stdc_trailing_ones_ul F
GLIBC_2.39 stdc_trailing_ones_ull F
GLIBC_2.39 stdc_trailing_ones_us F
GLIBC_2.39 stdc_trailing_zeros_uc F
GLIBC_2.39 stdc_trailing_zeros_ui F
GLIBC_2.39 stdc_trailing_zeros_ul F
GLIBC_2.39 stdc_trailing_zeros_ull F
GLIBC_2.39 stdc_trailing_zeros_us F
HURD_CTHREADS_0.3 __cthread_getspecific F
HURD_CTHREADS_0.3 __cthread_keycreate F
HURD_CTHREADS_0.3 __cthread_setspecific F

View File

@ -2678,3 +2678,73 @@ GLIBC_2.39 pidfd_spawn F
GLIBC_2.39 pidfd_spawnp F
GLIBC_2.39 posix_spawnattr_getcgroup_np F
GLIBC_2.39 posix_spawnattr_setcgroup_np F
GLIBC_2.39 stdc_bit_ceil_uc F
GLIBC_2.39 stdc_bit_ceil_ui F
GLIBC_2.39 stdc_bit_ceil_ul F
GLIBC_2.39 stdc_bit_ceil_ull F
GLIBC_2.39 stdc_bit_ceil_us F
GLIBC_2.39 stdc_bit_floor_uc F
GLIBC_2.39 stdc_bit_floor_ui F
GLIBC_2.39 stdc_bit_floor_ul F
GLIBC_2.39 stdc_bit_floor_ull F
GLIBC_2.39 stdc_bit_floor_us F
GLIBC_2.39 stdc_bit_width_uc F
GLIBC_2.39 stdc_bit_width_ui F
GLIBC_2.39 stdc_bit_width_ul F
GLIBC_2.39 stdc_bit_width_ull F
GLIBC_2.39 stdc_bit_width_us F
GLIBC_2.39 stdc_count_ones_uc F
GLIBC_2.39 stdc_count_ones_ui F
GLIBC_2.39 stdc_count_ones_ul F
GLIBC_2.39 stdc_count_ones_ull F
GLIBC_2.39 stdc_count_ones_us F
GLIBC_2.39 stdc_count_zeros_uc F
GLIBC_2.39 stdc_count_zeros_ui F
GLIBC_2.39 stdc_count_zeros_ul F
GLIBC_2.39 stdc_count_zeros_ull F
GLIBC_2.39 stdc_count_zeros_us F
GLIBC_2.39 stdc_first_leading_one_uc F
GLIBC_2.39 stdc_first_leading_one_ui F
GLIBC_2.39 stdc_first_leading_one_ul F
GLIBC_2.39 stdc_first_leading_one_ull F
GLIBC_2.39 stdc_first_leading_one_us F
GLIBC_2.39 stdc_first_leading_zero_uc F
GLIBC_2.39 stdc_first_leading_zero_ui F
GLIBC_2.39 stdc_first_leading_zero_ul F
GLIBC_2.39 stdc_first_leading_zero_ull F
GLIBC_2.39 stdc_first_leading_zero_us F
GLIBC_2.39 stdc_first_trailing_one_uc F
GLIBC_2.39 stdc_first_trailing_one_ui F
GLIBC_2.39 stdc_first_trailing_one_ul F
GLIBC_2.39 stdc_first_trailing_one_ull F
GLIBC_2.39 stdc_first_trailing_one_us F
GLIBC_2.39 stdc_first_trailing_zero_uc F
GLIBC_2.39 stdc_first_trailing_zero_ui F
GLIBC_2.39 stdc_first_trailing_zero_ul F
GLIBC_2.39 stdc_first_trailing_zero_ull F
GLIBC_2.39 stdc_first_trailing_zero_us F
GLIBC_2.39 stdc_has_single_bit_uc F
GLIBC_2.39 stdc_has_single_bit_ui F
GLIBC_2.39 stdc_has_single_bit_ul F
GLIBC_2.39 stdc_has_single_bit_ull F
GLIBC_2.39 stdc_has_single_bit_us F
GLIBC_2.39 stdc_leading_ones_uc F
GLIBC_2.39 stdc_leading_ones_ui F
GLIBC_2.39 stdc_leading_ones_ul F
GLIBC_2.39 stdc_leading_ones_ull F
GLIBC_2.39 stdc_leading_ones_us F
GLIBC_2.39 stdc_leading_zeros_uc F
GLIBC_2.39 stdc_leading_zeros_ui F
GLIBC_2.39 stdc_leading_zeros_ul F
GLIBC_2.39 stdc_leading_zeros_ull F
GLIBC_2.39 stdc_leading_zeros_us F
GLIBC_2.39 stdc_trailing_ones_uc F
GLIBC_2.39 stdc_trailing_ones_ui F
GLIBC_2.39 stdc_trailing_ones_ul F
GLIBC_2.39 stdc_trailing_ones_ull F
GLIBC_2.39 stdc_trailing_ones_us F
GLIBC_2.39 stdc_trailing_zeros_uc F
GLIBC_2.39 stdc_trailing_zeros_ui F
GLIBC_2.39 stdc_trailing_zeros_ul F
GLIBC_2.39 stdc_trailing_zeros_ull F
GLIBC_2.39 stdc_trailing_zeros_us F

Some files were not shown because too many files have changed in this diff Show More