Pre-calculate LENGTH_MINUS_ONE