I read it wrong.  Off-by-one errors are especially confusing in boolean arithmetic.