It's a good habit to use unsigned ints for values that you're going to bit-manipulate (and in general - if a value is never < 0, there's no reason for it to be signed.)