@@ -733,7 +733,7 @@ copyto!(dest::AbstractArray, src::AbstractArray) =
733
733
734
734
function copyto! (:: IndexStyle , dest:: AbstractArray , :: IndexStyle , src:: AbstractArray )
735
735
destinds, srcinds = LinearIndices (dest), LinearIndices (src)
736
- isempty (srcinds) || (first (srcinds) ∈ destinds && last (srcinds) ∈ destinds ) ||
736
+ isempty (srcinds) || (checkbounds (Bool, destinds, first (srcinds)) && checkbounds (Bool, destinds, last (srcinds)) ) ||
737
737
throw (BoundsError (dest, srcinds))
738
738
@inbounds for i in srcinds
739
739
dest[i] = src[i]
743
743
744
744
function copyto! (:: IndexStyle , dest:: AbstractArray , :: IndexCartesian , src:: AbstractArray )
745
745
destinds, srcinds = LinearIndices (dest), LinearIndices (src)
746
- isempty (srcinds) || (first (srcinds) ∈ destinds && last (srcinds) ∈ destinds ) ||
746
+ isempty (srcinds) || (checkbounds (Bool, destinds, first (srcinds)) && checkbounds (Bool, destinds, last (srcinds)) ) ||
747
747
throw (BoundsError (dest, srcinds))
748
748
i = 0
749
749
@inbounds for a in src
758
758
759
759
function copyto! (dest:: AbstractArray , dstart:: Integer , src:: AbstractArray , sstart:: Integer )
760
760
srcinds = LinearIndices (src)
761
- sstart ∈ srcinds || throw (BoundsError (src, sstart))
761
+ checkbounds (Bool, srcinds, sstart) || throw (BoundsError (src, sstart))
762
762
copyto! (dest, dstart, src, sstart, last (srcinds)- sstart+ 1 )
763
763
end
764
764
@@ -768,8 +768,8 @@ function copyto!(dest::AbstractArray, dstart::Integer,
768
768
n == 0 && return dest
769
769
n < 0 && throw (ArgumentError (string (" tried to copy n=" , n, " elements, but n should be nonnegative" )))
770
770
destinds, srcinds = LinearIndices (dest), LinearIndices (src)
771
- (dstart ∈ destinds && dstart+ n- 1 ∈ destinds ) || throw (BoundsError (dest, dstart: dstart+ n- 1 ))
772
- (sstart ∈ srcinds && sstart+ n- 1 ∈ srcinds ) || throw (BoundsError (src, sstart: sstart+ n- 1 ))
771
+ (checkbounds (Bool, destinds, dstart) && checkbounds (Bool, destinds, dstart+ n- 1 ) ) || throw (BoundsError (dest, dstart: dstart+ n- 1 ))
772
+ (checkbounds (Bool, srcinds, sstart) && checkbounds (Bool, srcinds, sstart+ n- 1 ) ) || throw (BoundsError (src, sstart: sstart+ n- 1 ))
773
773
@inbounds for i = 0 : (n- 1 )
774
774
dest[dstart+ i] = src[sstart+ i]
775
775
end
0 commit comments