39. Bitwise Rotation and Counting-II

Question.4

A developer uses the n & (n - 1) trick to check if a register has exactly one error flag set:

uint8_t err_flags = read_error_register();
if ((err_flags & (err_flags - 1)) == 0) {
   handle_single_error(err_flags);
} else {
   handle_multiple_errors(err_flags);
}

Under what condition does this code misclassify the error state?

Need Help? Refer to the Quick Guide below

Select Answer