Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve code to avoid reliance on computation of length #383

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading