Skip to content

Commit a005c07

Browse files
authored
Simplify first index in FastContiguousSubArray definition (JuliaLang#56491)
Since `Slice <: AbstractUnitRange` and `Union{Slice, AbstractUnitRange} == AbstractUnitRange`, we may simplify the first index.
1 parent 0e811e4 commit a005c07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/subarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ end
342342

343343
# We can avoid a multiplication if the first parent index is a Colon or AbstractUnitRange,
344344
# or if all the indices are scalars, i.e. the view is for a single value only
345-
FastContiguousSubArray{T,N,P,I<:Union{Tuple{Union{Slice, AbstractUnitRange}, Vararg{Any}},
345+
FastContiguousSubArray{T,N,P,I<:Union{Tuple{AbstractUnitRange, Vararg{Any}},
346346
Tuple{Vararg{ScalarIndex}}}} = SubArray{T,N,P,I,true}
347347

348348
@inline _reindexlinear(V::FastContiguousSubArray, i::Int) = V.offset1 + i

0 commit comments

Comments
 (0)