Fix a series of undefined behaviours
authorJoost Vandevondele <Joost.VandeVondele@gmail.com>
Fri, 21 Oct 2016 04:48:07 +0000 (06:48 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 27 Oct 2016 04:44:41 +0000 (06:44 +0200)
commit40b1b2717827b5516c7d3978bdc341e801a650e7
tree30dbbc45bbeec6ac9111809d965e19710b1e0633
parentbf51b4796abd400648ba751fe545fd1785232a6b
Fix a series of undefined behaviours

Avoid shifting negative signed integers and use typed
enum to avoids decrementing a variable beyond its defined
range, like:
       for (Rank r = RANK_8; r >= RANK_1; --r)

Changes were tested individually and passed SPRT[-3, 1].

With this patch gcc --sanitize builds cleanly.

No functional change.
src/types.h