I'm really sure. If `k` is ever assigned a negative value this code goes into an infinite loop. `i` in both cases can never be negative. left is only ever assigned from uint32's and in one case from an istream but we don't use that function. The only way this can be broken is if the code relies on undefined behaviour in casting unsigned integers to signed in which case we need to expose it as both clang and gcc optimise casts based on the assumption that the cast is valid.