1717#include <stdbool.h> // bool in C
1818
1919#define STDBIT_STUB_FUNCTION (FUNC_NAME , LEADING_VAL ) \
20- unsigned FUNC_NAME##_uc(unsigned char x) { return LEADING_VAL##AU; } \
21- unsigned FUNC_NAME##_us(unsigned short x) { return LEADING_VAL##BU; } \
22- unsigned FUNC_NAME##_ui(unsigned int x) { return LEADING_VAL##CU; } \
23- unsigned FUNC_NAME##_ul(unsigned long x) { return LEADING_VAL##DU; } \
24- unsigned FUNC_NAME##_ull(unsigned long long x) { return LEADING_VAL##EU; }
20+ unsigned FUNC_NAME##_uc([[maybe_unused]] unsigned char x) { \
21+ return LEADING_VAL##AU; \
22+ } \
23+ unsigned FUNC_NAME##_us([[maybe_unused]] unsigned short x) { \
24+ return LEADING_VAL##BU; \
25+ } \
26+ unsigned FUNC_NAME##_ui([[maybe_unused]] unsigned int x) { \
27+ return LEADING_VAL##CU; \
28+ } \
29+ unsigned FUNC_NAME##_ul([[maybe_unused]] unsigned long x) { \
30+ return LEADING_VAL##DU; \
31+ } \
32+ unsigned FUNC_NAME##_ull([[maybe_unused]] unsigned long long x) { \
33+ return LEADING_VAL##EU; \
34+ }
2535
2636__BEGIN_C_DECLS
2737
@@ -36,24 +46,42 @@ STDBIT_STUB_FUNCTION(stdc_first_trailing_one, 0x1)
3646STDBIT_STUB_FUNCTION (stdc_count_zeros , 0x2 )
3747STDBIT_STUB_FUNCTION (stdc_count_ones , 0x3 )
3848
39- bool stdc_has_single_bit_uc (unsigned char x ) { return false; }
40- bool stdc_has_single_bit_us (unsigned short x ) { return false; }
41- bool stdc_has_single_bit_ui (unsigned x ) { return false; }
42- bool stdc_has_single_bit_ul (unsigned long x ) { return false; }
43- bool stdc_has_single_bit_ull (unsigned long long x ) { return false; }
49+ bool stdc_has_single_bit_uc ([[maybe_unused ]] unsigned char x ) { return false; }
50+ bool stdc_has_single_bit_us ([[maybe_unused ]] unsigned short x ) { return false; }
51+ bool stdc_has_single_bit_ui ([[maybe_unused ]] unsigned x ) { return false; }
52+ bool stdc_has_single_bit_ul ([[maybe_unused ]] unsigned long x ) { return false; }
53+ bool stdc_has_single_bit_ull ([[maybe_unused ]] unsigned long long x ) {
54+ return false;
55+ }
4456
4557STDBIT_STUB_FUNCTION (stdc_bit_width , 0x4 )
4658
47- unsigned char stdc_bit_floor_uc (unsigned char x ) { return 0x5AU ; }
48- unsigned short stdc_bit_floor_us (unsigned short x ) { return 0x5BU ; }
49- unsigned stdc_bit_floor_ui (unsigned x ) { return 0x5CU ; }
50- unsigned long stdc_bit_floor_ul (unsigned long x ) { return 0x5DUL ; }
51- unsigned long long stdc_bit_floor_ull (unsigned long long x ) { return 0x5EULL ; }
52-
53- unsigned char stdc_bit_ceil_uc (unsigned char x ) { return 0x6AU ; }
54- unsigned short stdc_bit_ceil_us (unsigned short x ) { return 0x6BU ; }
55- unsigned stdc_bit_ceil_ui (unsigned x ) { return 0x6CU ; }
56- unsigned long stdc_bit_ceil_ul (unsigned long x ) { return 0x6DUL ; }
57- unsigned long long stdc_bit_ceil_ull (unsigned long long x ) { return 0x6EULL ; }
59+ unsigned char stdc_bit_floor_uc ([[maybe_unused ]] unsigned char x ) {
60+ return 0x5AU ;
61+ }
62+ unsigned short stdc_bit_floor_us ([[maybe_unused ]] unsigned short x ) {
63+ return 0x5BU ;
64+ }
65+ unsigned stdc_bit_floor_ui ([[maybe_unused ]] unsigned x ) { return 0x5CU ; }
66+ unsigned long stdc_bit_floor_ul ([[maybe_unused ]] unsigned long x ) {
67+ return 0x5DUL ;
68+ }
69+ unsigned long long stdc_bit_floor_ull ([[maybe_unused ]] unsigned long long x ) {
70+ return 0x5EULL ;
71+ }
72+
73+ unsigned char stdc_bit_ceil_uc ([[maybe_unused ]] unsigned char x ) {
74+ return 0x6AU ;
75+ }
76+ unsigned short stdc_bit_ceil_us ([[maybe_unused ]] unsigned short x ) {
77+ return 0x6BU ;
78+ }
79+ unsigned stdc_bit_ceil_ui ([[maybe_unused ]] unsigned x ) { return 0x6CU ; }
80+ unsigned long stdc_bit_ceil_ul ([[maybe_unused ]] unsigned long x ) {
81+ return 0x6DUL ;
82+ }
83+ unsigned long long stdc_bit_ceil_ull ([[maybe_unused ]] unsigned long long x ) {
84+ return 0x6EULL ;
85+ }
5886
5987__END_C_DECLS
0 commit comments