Speed up index check slightly

Previously, the index was checked using `0 <= i && i < n`. Since `&&` short-circuits, this compiles to signed-compare/branch/signed-compare. It's slightly better to use unsigned comparison, which takes it down to a single unsigned-compare operation. This technique relies on `n >= 0`.