Skip to content

Commit

Permalink
testset-ify subarray tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbauman committed Feb 11, 2020
1 parent d378003 commit e88082b
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 308 deletions.
4 changes: 2 additions & 2 deletions base/reshapedarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,6 @@ compute_stride1(s, inds, I::Tuple{ReshapedRange, Vararg{Any}}) = s*step(I[1].par
compute_offset1(parent::AbstractVector, stride1::Integer, I::Tuple{ReshapedRange}) =
(@_inline_meta; first(I[1]) - first(axes1(I[1]))*stride1)
substrides(strds::NTuple{N,Int}, I::Tuple{ReshapedUnitRange, Vararg{Any}}) where N =
(size_to_strides(strds, size(I[1]))..., substrides(tail(strds), tail(I))...)
unsafe_convert(::Type{Ptr{T}}, V::SubArray{T,N,P,<:Tuple{Vararg{Union{RangeIndex,ReshapedUnitRange,CartesianIndex}}}}) where {T,N,P} =
(size_to_strides(strds[1], size(I[1])...)..., substrides(tail(strds), tail(I))...)
unsafe_convert(::Type{Ptr{T}}, V::SubArray{T,N,P,<:Tuple{Vararg{Union{RangeIndex,ReshapedUnitRange}}}}) where {T,N,P} =
unsafe_convert(Ptr{T}, V.parent) + (first_index(V)-1)*sizeof(T)
Loading

0 comments on commit e88082b

Please sign in to comment.