The bit_operations_tests probe at the behavior of 1U << -1 within the loop at
|
for (i = -1; i < 32; i++) |
|
{ |
|
ax32 = most_significant_one32(1U << i); |
This is, formally, undefined behavior in C. Specifically, C23 §6.5.8 ¶3 says "If the value of the right operand is negative or [...], the behavior is undefined." I think that the loop variable should start at 0 and, if the behavior of
most_significant_one32 on
0 is to be tested, specific code should be added. Does that seem reasonable?