19 Commits

Author SHA1 Message Date
Nick Desaulniers
b8ba266820
[libc][test][stdbit] fix -Wimplicit-int-conversion (#126616)
When cross compiling the libc-stdbit-tests, the existing tests trigger numerous
instances of -Wimplicit-int-conversion. The truncation of these implicit
promotions is intentional.
2025-02-11 09:31:01 -08:00
Roland McGrath
a21cf5663c
[libc] Fix use of cpp::numeric_limits<...>::digits (#102674)
The previous change replaced INT_WIDTH with
cpp::numberic_limits<int>::digits, but these don't have the same
value.  While INT_WIDTH == UINT_WIDTH, not so for ::digits, so
use cpp::numberic_limits<unsigned int>::digits et al instead for
the intended effects.

Bug: https://issues.fuchsia.dev/358196552
2024-08-09 13:09:23 -07:00
Roland McGrath
2f6a879790
[libc] Use cpp::numeric_limits in preference to C23 <limits.h> macros (#102665)
This updates some code to consistently use cpp::numeric_limits,
the src/__support polyfill for std::numeric_limits, rather than
the C <limits.h> macros.  This is in keeping with the general
C++-oriented style in libc code, and also sidesteps issues about
the new C23 *_WIDTH macros that the compiler-provided header does
not define outside C23 mode.

Bug: https://issues.fuchsia.dev/358196552
2024-08-09 12:44:40 -07:00
Michael Flanders
75b0d384fb
[libc][stdbit][c23] adds implementation of stdc_bit_ceil functions (#84657)
Closes #84652.

Based on #84233.
2024-03-10 12:53:28 -04:00
Nick Desaulniers
101a13df71
[libc][stdbit] implement stdc_bit_floor (C23) (#84233) 2024-03-07 08:38:04 -08:00
Nick Desaulniers
041638c429
[libc][stdbit] implement stdc_bit_width (C23) (#83892) 2024-03-05 09:49:41 -08:00
Nick Desaulniers
eaa0d3b133
[libc][test][stdbit] fix has_single_bit test names (#83904)
This was copy+pasted from count_ones without updating the test name completely.
2024-03-04 13:57:13 -08:00
Nick Desaulniers
06bcd9da16
[libc][stdbit] implement stdc_has_single_bit (C23) (#83168) 2024-02-27 13:45:37 -08:00
Nick Desaulniers
d8406d48a8
[libc][stdbit] implement stdc_count_ones (C23) (#82444) 2024-02-26 09:25:24 -08:00
Nick Desaulniers
f70d5c0bc8
[libc][stdbit] implement stdc_count_zeros (C23) (#82437) 2024-02-26 09:23:15 -08:00
Nick Desaulniers
6297479ff0
[libc][stdbit] implement stdc_first_trailing_one (C23) (#81768) 2024-02-14 11:10:48 -08:00
Nick Desaulniers
16e7d6842e
[libc][stdbit] implement stdc_first_trailing_zero (C23) (#81526) 2024-02-14 10:34:28 -08:00
Nick Desaulniers
60596716c2
[libc][stdbit] implement stdc_first_leading_one (C23) (#81502) 2024-02-14 09:16:00 -08:00
Nick Desaulniers
d2d6b368a1
[libc][stdbit] implement stdc_first_leading_zero (C23) (#81340) 2024-02-12 08:31:53 -08:00
Nick Desaulniers
7760006d8d
[libc][stdbit] implement stdc_trailing_ones (C23) (#80459) 2024-02-07 02:56:24 -08:00
Nick Desaulniers
d5a3de4aee
[libc][stdbit] implement stdc_trailing_zeros (C23) (#80344) 2024-02-06 06:27:03 -08:00
Nick Desaulniers
edbd93d370
[libc][stdbit] fix return types (#80337)
All of the functions I've previously implemented return an unsigned int; not
the parameter type.
2024-02-01 13:09:33 -08:00
Nick Desaulniers
6a3fde6d60
[libc] implement stdc_leading_ones (C23) (#80082) 2024-02-01 10:14:22 -08:00
Nick Desaulniers
7bc5eaa02f
[libc] implement stdc_leading_zeros_u* for stdbit.h (#79669)
- stdbit.stdc_leading_zeros_uc
- stdbit.stdc_leading_zeros_us
- stdbit.stdc_leading_zeros_ui
- stdbit.stdc_leading_zeros_ul
- stdbit.stdc_leading_zeros_ull

Test via:
$ ninja libc-stdbit-tests libc_include_tests
2024-01-29 15:47:55 -08:00