From 30b8419b93a30adef008bd7319c8cfbfce3aada9 Mon Sep 17 00:00:00 2001 From: KristofferC Date: Wed, 6 May 2020 15:02:30 +0200 Subject: [PATCH] tweak inbounds usage --- base/strings/search.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/base/strings/search.jl b/base/strings/search.jl index 3db59b68aac35..9d2fdf73afff4 100644 --- a/base/strings/search.jl +++ b/base/strings/search.jl @@ -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 @@ -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