Skip to content

Commit

Permalink
microptimize the check for valid digit
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Nov 2, 2018
1 parent 0fc407b commit a6b38a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ function int_from_bytes(pc::ParserContext{<:Any,IntType},
num = IntType(0)
@inbounds for i in from:to
c = bytes[i]
if isjsondigit(c)
num = IntType(10) * num + IntType(c - DIGIT_ZERO)
dig = c - DIGIT_ZERO
if dig < 0x10
num = IntType(10) * num + IntType(dig)
else
_error(E_BAD_NUMBER, ps)
end
Expand Down

0 comments on commit a6b38a0

Please sign in to comment.