Skip to content

Commit

Permalink
NFC simplification of get_value_from_code
Browse files Browse the repository at this point in the history
eliminates `1:length(code)` construct
increases concision
doesn't change the generated code.
  • Loading branch information
LilithHafner authored and GunnarFarneback committed Sep 23, 2024
1 parent a73ab50 commit b04ce13
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Inflate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ end
function get_value_from_code(data::AbstractInflateData,
code::Vector{Vector{Int}})
v = 0
for i = 1:length(code)
for c in code
v = (v << 1) | getbit(data)
if v < length(code[i])
return code[i][1 + v]
if v < length(c)
return c[1 + v]
end
v -= length(code[i])
v -= length(c)
end
error("incomplete code table")
end
Expand Down

0 comments on commit b04ce13

Please sign in to comment.