/* Test count operations from stdbit.h type: unsigned short, unsigned int, unsigned long, unsigned long long */ #include #if __STDC_VERSION_STDBIT_H__ >= 202311L #pragma std_c23 #include #endif volatile {type} i, j; void testCount(void) { #if __STDC_VERSION_STDBIT_H__ >= 202311L i = 0x10; j = ~i; ASSERT (stdc_count_ones(i) == 1); ASSERT (stdc_count_zeros(j) == 1); ASSERT (stdc_has_single_bit(i)); ASSERT (!stdc_has_single_bit(j)); i = 0xff; j = ~i; ASSERT (stdc_count_ones(i) == 8); ASSERT (stdc_count_zeros(j) == 8); ASSERT (!stdc_has_single_bit(i)); ASSERT (!stdc_has_single_bit(j)); #endif }