[PATCH v2 0/2] Add C23 stdbit.h functionality

Joel Sherrill <[email protected]> Fri, 10 Apr 2026 14:21:08 -0500
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
In response to comments on the previous version of this patch,
I submitted my first Cygwin patch to add the missing _WIDTH
constants to the Cygwin limits.h. That patch is now merged
which hopefully removes the barrier for merging this.

Note that a limits.h implementation can "include_next" the
GCC limits.h and it will provide many constants. Cygwin
had a self-contained version and they had to be added.

Two patches:
  - 0001 - adds the files
  - 0002 - regenerates

--joel

Joel Sherrill (2):
  newlib/libc: Add C23 stdbit.h from FreeBSD
  Makefile.inc, stdbit/Makefile.inc: Add stdbit

 newlib/libc/Makefile.inc                      |   1 +
 newlib/libc/include/stdbit.h                  | 124 ++++++++++++++++++
 newlib/libc/stdbit/Makefile.inc               |  15 +++
 newlib/libc/stdbit/stdc_bit_ceil.3            |  81 ++++++++++++
 newlib/libc/stdbit/stdc_bit_ceil.c            |  71 ++++++++++
 newlib/libc/stdbit/stdc_bit_floor.3           |  83 ++++++++++++
 newlib/libc/stdbit/stdc_bit_floor.c           |  53 ++++++++
 newlib/libc/stdbit/stdc_bit_width.3           | 104 +++++++++++++++
 newlib/libc/stdbit/stdc_bit_width.c           |  53 ++++++++
 newlib/libc/stdbit/stdc_count_ones.3          |  85 ++++++++++++
 newlib/libc/stdbit/stdc_count_ones.c          |  38 ++++++
 newlib/libc/stdbit/stdc_count_zeros.3         |  84 ++++++++++++
 newlib/libc/stdbit/stdc_count_zeros.c         |  38 ++++++
 newlib/libc/stdbit/stdc_first_leading_one.3   |  93 +++++++++++++
 newlib/libc/stdbit/stdc_first_leading_one.c   |  57 ++++++++
 newlib/libc/stdbit/stdc_first_leading_zero.3  |  92 +++++++++++++
 newlib/libc/stdbit/stdc_first_leading_zero.c  |  57 ++++++++
 newlib/libc/stdbit/stdc_first_trailing_one.3  | 110 ++++++++++++++++
 newlib/libc/stdbit/stdc_first_trailing_one.c  |  52 ++++++++
 newlib/libc/stdbit/stdc_first_trailing_zero.3 |  93 +++++++++++++
 newlib/libc/stdbit/stdc_first_trailing_zero.c |  53 ++++++++
 newlib/libc/stdbit/stdc_has_single_bit.3      |  98 ++++++++++++++
 newlib/libc/stdbit/stdc_has_single_bit.c      |  38 ++++++
 newlib/libc/stdbit/stdc_leading_ones.3        |  86 ++++++++++++
 newlib/libc/stdbit/stdc_leading_ones.c        |  60 +++++++++
 newlib/libc/stdbit/stdc_leading_zeros.3       |  86 ++++++++++++
 newlib/libc/stdbit/stdc_leading_zeros.c       |  60 +++++++++
 newlib/libc/stdbit/stdc_trailing_ones.3       |  86 ++++++++++++
 newlib/libc/stdbit/stdc_trailing_ones.c       |  56 ++++++++
 newlib/libc/stdbit/stdc_trailing_zeros.3      |  87 ++++++++++++
 newlib/libc/stdbit/stdc_trailing_zeros.c      |  56 ++++++++
 31 files changed, 2150 insertions(+)
 create mode 100644 newlib/libc/include/stdbit.h
 create mode 100644 newlib/libc/stdbit/Makefile.inc
 create mode 100644 newlib/libc/stdbit/stdc_bit_ceil.3
 create mode 100644 newlib/libc/stdbit/stdc_bit_ceil.c
 create mode 100644 newlib/libc/stdbit/stdc_bit_floor.3
 create mode 100644 newlib/libc/stdbit/stdc_bit_floor.c
 create mode 100644 newlib/libc/stdbit/stdc_bit_width.3
 create mode 100644 newlib/libc/stdbit/stdc_bit_width.c
 create mode 100644 newlib/libc/stdbit/stdc_count_ones.3
 create mode 100644 newlib/libc/stdbit/stdc_count_ones.c
 create mode 100644 newlib/libc/stdbit/stdc_count_zeros.3
 create mode 100644 newlib/libc/stdbit/stdc_count_zeros.c
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_one.3
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_one.c
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_zero.3
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_zero.c
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_one.3
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_one.c
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_zero.3
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_zero.c
 create mode 100644 newlib/libc/stdbit/stdc_has_single_bit.3
 create mode 100644 newlib/libc/stdbit/stdc_has_single_bit.c
 create mode 100644 newlib/libc/stdbit/stdc_leading_ones.3
 create mode 100644 newlib/libc/stdbit/stdc_leading_ones.c
 create mode 100644 newlib/libc/stdbit/stdc_leading_zeros.3
 create mode 100644 newlib/libc/stdbit/stdc_leading_zeros.c
 create mode 100644 newlib/libc/stdbit/stdc_trailing_ones.3
 create mode 100644 newlib/libc/stdbit/stdc_trailing_ones.c
 create mode 100644 newlib/libc/stdbit/stdc_trailing_zeros.3
 create mode 100644 newlib/libc/stdbit/stdc_trailing_zeros.c

-- 
2.47.3