Could you turn this into a `for()`? It's just sugar coating, but it shows the purpose in a more clear way, and (if you also (re)initialize `i = 0` in the `for`, it also prevents people from breaking it by accidentally assigning a value to it before this is executed.

To be noted, when `i == IT_MAX-1`, `1<<i` equals to `0x40000` (`1<<18`), which is larger than `sd->state.autoloottype`. The comparison is safe though, as both operands get promoted to `int` before the `&` is evaluated (`sd->state.autoloottype & 0x40000` is always false, but it won't break anything)