Making sure to avoid undefined behaviour

Mainly implementing signed overflow behaviour in a way that isn't
undefined in the C standard
5 files changed