Avoids undefined behaviour in ARM-optimized code

Casting to unsigned to avoid shifting negative values left.
5 files changed