Question.5
A developer replaces the modulo in a circular buffer with a bitmask for performance:
#define BUF_SIZE 16 // Power of 2
cb->head = (cb->head + 1) & (BUF_SIZE - 1);
// Instead of: (cb->head + 1) % BUF_SIZEIs this optimization valid? What is the constraint?