Or-ing 1 onto codepoint before calling leading_zeroes() should get a decent compiler to remove the branch.