Hi Bruno, On 5/4/24 7:52 AM, Bruno Haible wrote: > And we're not yet done with the header file substitutes. One is still missing > from Gnulib: <stdbit.h> [1]. The only thing that has changed since last year > is that glibc 2.39 now has this header file [2]. But who will want to use it, > as long as it's not portable?
C23 and the upcoming POSIX release seem to have a lot of useful stuff. IIRC in <stdbit.h> there is: #define __STDC_ENDIAN_LITTLE__ /* Unique constant */ #define __STDC_ENDIAN_BIG__ /* Unique constant */ #define __STDC_ENDIAN_NATIVE__ /* __STDC_ENDIAN_LITTLE__ or __STDC_ENDIAN_BIG__ */ probably with values taken from Glibc's <endian.h> or BSD's <sys/endian.h>. But, I think the next POSIX revision has <endian.h> like Glibc which I prefer. So these defines: #define LITTLE_ENDIAN /* Unique constant */ #define BIG_ENDIAN /* Unique constant */ #define BYTE_ORDER /* LITTLE_ENDIAN or BIG_ENDIAN */ plus functions or macros: uint16_t be16toh (uint16_t); uint16_t htobe16 (uint16_t); I could try to work on that if it seems useful to anyone else. Collin