Skip to content

Commit fb4e86f

Browse files
giordanombauman
andcommitted
Use _checkbounds_array in more places
Co-authored-by: Matt Bauman <mbauman@juliahub.com>
1 parent 7b6065e commit fb4e86f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

base/genericmemory.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ sizeof(a::GenericMemory) = Core.sizeof(a)
106106
# multi arg case will be overwritten later. This is needed for bootstrapping
107107
function isassigned(a::GenericMemory, i::Int)
108108
@inline
109-
@boundscheck (i - 1)%UInt < length(a)%UInt || return false
109+
@boundscheck _checkbounds_array(Bool, a, i) || return false
110110
return @inbounds memoryref_isassigned(memoryref(a, i), default_access_order(a), false)
111111
end
112112

@@ -227,7 +227,7 @@ Memory{T}(x::AbstractArray{S,1}) where {T,S} = copyto_axcheck!(Memory{T}(undef,
227227

228228
function _iterate_array(A::Union{Memory, Array}, i::Int)
229229
@inline
230-
(i - 1)%UInt < length(A)%UInt ? (A[i], i + 1) : nothing
230+
_checkbounds_array(Bool, A, i) ? (A[i], i + 1) : nothing
231231
end
232232

233233
iterate(A::Memory, i=1) = (@inline; _iterate_array(A, i))

0 commit comments

Comments
 (0)