Skip to content

Commit

Permalink
Merge pull request #383 from vtjnash/patch-1
Browse files Browse the repository at this point in the history
Improve code to avoid reliance on computation of length
  • Loading branch information
pfitzseb authored Feb 1, 2024
2 parents a1d330c + 460402e commit e3c42b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ else
if c === 'x' || c === 'u' || c === 'U'
maxiter = c === 'x' ? 2 : c === 'u' ? 4 : 8
n = 0
for _ in 1:min(length(a), maxiter)
for _ in 1:maxiter
isempty(a) && break
nc = popfirst!(a)
n = '0' <= nc <= '9' ? n << 4 + (nc - '0') :
'a' <= nc <= 'f' ? n << 4 + (nc - 'a' + 10) :
Expand All @@ -564,7 +565,8 @@ else
ok = n <= 0x10ffff
elseif '0' <= c <= '7'
n = c - '0'
for _ in 1:min(length(a), 3)
for _ in 1:3
isempty(a) && break
nc = popfirst!(a)
n = ('0' <= c <= '7') ? n << 3 + nc - '0' : return false
end
Expand Down

0 comments on commit e3c42b9

Please # to comment.