Skip to content

Commit

Permalink
tweak inbounds usage
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed May 6, 2020
1 parent cbff131 commit 506cae1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions base/strings/search.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ function findnext(testf::Function, s::AbstractString, i::Integer)
1 i z || throw(BoundsError(s, i))
@inbounds i == z || isvalid(s, i) || string_index_err(s, i)
e = lastindex(s)
@inbounds while i <= e
testf(s[i]) && return i
i = nextind(s, i)
while i <= e
testf(@inbounds s[i]) && return i
i = @inbounds nextind(s, i)
end
return nothing
end
Expand Down Expand Up @@ -340,9 +340,9 @@ function findprev(testf::Function, s::AbstractString, i::Integer)
0 i z || throw(BoundsError(s, i))
i == z && return nothing
@inbounds i == 0 || isvalid(s, i) || string_index_err(s, i)
@inbounds while i >= 1
testf(s[i]) && return i
i = prevind(s, i)
while i >= 1
testf(@inbounds s[i]) && return i
i = @inbounds prevind(s, i)
end
return nothing
end
Expand Down

0 comments on commit 506cae1

Please sign in to comment.