Skip to content

Commit

Permalink
Merge pull request #20686 from JuliaLang/teh/linear_indices_amb
Browse files Browse the repository at this point in the history
Minor fixes to checkbounds_linear_indices and getindex for ranges
  • Loading branch information
timholy authored Feb 20, 2017
2 parents 75cfcb9 + faa9b15 commit 30a215d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,11 @@ function checkbounds_linear_indices(::Type{Bool}, IA::Tuple{AbstractUnitRange,Va
@_inline_meta
checkindex(Bool, IA[1], i)
end
function checkbounds_linear_indices(::Type{Bool}, IA::Tuple, i::Union{Slice,Colon})
function checkbounds_linear_indices(::Type{Bool}, IA::Tuple{Vararg{OneTo}}, i::Union{Slice,Colon})
partial_linear_indexing_warning_lookup(length(IA))
true
end
function checkbounds_linear_indices(::Type{Bool}, IA::Tuple{AbstractUnitRange,Vararg{AbstractUnitRange}}, i::Union{Slice,Colon})
partial_linear_indexing_warning_lookup(length(IA))
true
end
Expand Down
2 changes: 1 addition & 1 deletion base/twiceprecision.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function getindex{T}(r::StepRangeLen{T,<:TwicePrecision,<:TwicePrecision}, s::Or
@boundscheck checkbounds(r, s)
soffset = 1 + round(Int, (r.offset - first(s))/step(s))
soffset = clamp(soffset, 1, length(s))
ioffset = start(s) + (soffset-1)*step(s)
ioffset = first(s) + (soffset-1)*step(s)
if step(s) == 1 || length(s) < 2
newstep = r.step
else
Expand Down

0 comments on commit 30a215d

Please sign in to comment.