1 /* Test find first leading bit operations from stdbit.h
3 type: unsigned short, unsigned int, unsigned long, unsigned long long
8 #ifdef __SDCC // Todo: Enable for all C23 implementations
17 #define OTHERBYTEBITS(x) (sizeof(x) - 1) * CHAR_BIT
22 #ifdef __SDCC // Todo: Enable for all C23 implementations
25 ASSERT (stdc_first_leading_one(i
) == 0);
26 ASSERT (stdc_first_leading_zero(i
) == 1);
29 ASSERT (stdc_first_leading_one(i
) == OTHERBYTEBITS(i
) + 8);
30 ASSERT (stdc_first_leading_zero(i
) == 1);
33 ASSERT (stdc_first_leading_one(i
) == OTHERBYTEBITS(i
) + 7);
34 ASSERT (stdc_first_leading_zero(i
) == 1);
37 ASSERT (stdc_first_leading_one(i
) == OTHERBYTEBITS(i
) + 7);
38 ASSERT (stdc_first_leading_zero(i
) == 1);
41 ASSERT (stdc_first_leading_one(i
) == OTHERBYTEBITS(i
) + 6);
42 ASSERT (stdc_first_leading_zero(i
) == 1);
45 ASSERT (stdc_first_leading_one(i
) == OTHERBYTEBITS(i
) + 5);
46 ASSERT (stdc_first_leading_zero(i
) == 1);
49 ASSERT (stdc_first_leading_one(i
) == OTHERBYTEBITS(i
) + 5);
50 ASSERT (stdc_first_leading_zero(i
) == 1);