Agreed. So any parse errors will have been caught on first pass. I hadn't noticed that.

In that case add an explicit cast of the result to (unsigned char) should be enough to make sure the shift is correct.