fix undefined shift operations on signed integers

This commit is contained in:
Miroslav Lichvar
2015-12-02 12:06:01 +01:00
parent 934df19c52
commit 8e71a46173
2 changed files with 13 additions and 5 deletions

View File

@@ -414,7 +414,7 @@ SRC_UpdateReachability(SRC_Instance inst, int reachable)
{
inst->reachability <<= 1;
inst->reachability |= !!reachable;
inst->reachability &= ~(-1 << SOURCE_REACH_BITS);
inst->reachability %= 1U << SOURCE_REACH_BITS;
if (inst->reachability_size < SOURCE_REACH_BITS)
inst->reachability_size++;