@@ -663,17 +663,17 @@ function checked_length(r::OrdinalRange{T}) where T
663663 else
664664 diff = checked_sub (stop, start)
665665 end
666- a = Integer ( div (diff, s) )
667- return checked_add (a, oneunit (a))
666+ a = div (diff, s)
667+ return Integer ( checked_add (a, oneunit (a) ))
668668end
669669
670670function checked_length (r:: AbstractUnitRange{T} ) where T
671671 # compiler optimization: remove dead cases from above
672672 if isempty (r)
673673 return Integer (first (r) - first (r))
674674 end
675- a = Integer ( checked_add ( checked_sub (last (r), first (r)) ))
676- return checked_add (a, oneunit (a))
675+ a = checked_sub (last (r), first (r))
676+ return Integer ( checked_add (a, oneunit (a) ))
677677end
678678
679679function length (r:: OrdinalRange{T} ) where T
@@ -690,15 +690,14 @@ function length(r::OrdinalRange{T}) where T
690690 else
691691 diff = stop - start
692692 end
693- a = Integer ( div (diff, s) )
694- return a + oneunit (a)
693+ a = div (diff, s)
694+ return Integer ( a + oneunit (a) )
695695end
696696
697-
698697function length (r:: AbstractUnitRange{T} ) where T
699698 @_inline_meta
700- a = Integer ( last (r) - first (r) ) # even when isempty, by construction (with overflow)
701- return a + oneunit (a)
699+ a = last (r) - first (r) # even when isempty, by construction (with overflow)
700+ return Integer ( a + oneunit (a) )
702701end
703702
704703length (r:: OneTo ) = Integer (r. stop - zero (r. stop))
0 commit comments