Avoid shift by negative number by turning condition around
Avoid undefined behaviour in condition which could shift by negative i. By checking first if `i >= 0` we avoid that case.
This commit is contained in:
parent
49d31414b7
commit
48302284a8
|
@ -865,7 +865,7 @@ static Scheme_Object *do_power(const Scheme_Object *a, uintptr_t b)
|
|||
result = scheme_make_integer(1);
|
||||
|
||||
i = sizeof(uintptr_t) * 8- 1;
|
||||
while (!((b >> i) & 0x1) && i >= 0)
|
||||
while (i >= 0 && !((b >> i) & 0x1))
|
||||
{
|
||||
i = i - 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user