This fixes a problem on gcc 4.8 (at least) which appears to be treating the value as unsigned by default.