The C99 standard says that the result of shifting a number by the
width in bits (or more) of the operand is undefined. For intel
processors, the shift count is masked to five bits (masked with 31),
so trying to left shift a 32-bit value for 32 bits or more does not
result in zero, as it might be expected (at least not on intel CPUs).
for (x = 0; x < 3; x++)
ei->content.e[x][y] = getMappedElement(getFile16BitBE(file));
+ // bits 0 - 31 of "has_event[]"
event_bits = getFile32BitBE(file);
- for (j = 0; j < NUM_CHANGE_EVENTS; j++)
+ for (j = 0; j < MIN(NUM_CHANGE_EVENTS, 32); j++)
if (event_bits & (1 << j))
ei->change->has_event[j] = TRUE;