18 Commits

Author SHA1 Message Date
Nick Desaulniers
f0c0ddae45
[libc] implement the final macros for stdbit.h support (#84798)
Relevant sections of n3096:
- 7.18.1p1
- 7.18.2
2024-03-12 08:39:17 -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
Michael Flanders
35b784379e
[libc][stdbit][c23] fixes typos in bit_width, bit_floor C type-generic macros (#84659)
Fixes #84658.

Assuming these were typos in the first place.

I am unsure of the best way to ensure that both sides of the
preprocessor condition in
`libc/include/llvm-libc-macros/stdbit-macros.h` are tested. Could
someone point me in the right direction for adding test coverage to the
non `__cplusplus` branch? Or maybe it is being tested and I've missed
it.
2024-03-10 01:46:39 -05: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
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
5a7a8f73c7
[libc] fix type generic stdc_leading_zeros for GCC (#79917)
GCC does not support _Generic in C++ mode. Use inline function definitions with
function overloading in __cplusplus mode.
2024-01-29 16:40:03 -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