Avoid duplicate bounds checks.