lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
# Scan a literal or distance tree to determine the frequencies of the codes
# in the bit length tree.
Scan a literal or distance tree to determine the frequencies of the codes
in the bit length tree.
Scan a literal or distance tree to determine the frequencies of the codes in the bit length tree .
def scan_tree(s,tree,max_code)
    prevlen = -1
    nextlen = tree[0].dl
    count = 0
    max_count = 7
    min_count = 4
    if nextlen == 0
      max_count = 138
      min_count = 3
    end
    tree[max_code+1].dl = 0xffff
    for n in 0 .. max_code
      curlen = nextlen
      nextlen = tree[n+1].dl
      count+=1
      if (count < max_count) && (curlen == nextlen)
        next
      elsif (count < min_count)
        s.bl_tree[curlen].fc += count
      elsif curlen != 0
        if (curlen != prevlen)
          s.bl_tree[curlen].fc+=1
        end
        s.bl_tree[REP_3_6].fc+=1
      elsif (count <= 10)
        s.bl_tree[REPZ_3_10].fc+=1
      else
        s.bl_tree[REPZ_11_138].fc+=1
      end
      count = 0
      prevlen = curlen
      if nextlen == 0
        max_count = 138
        min_count = 3
      elsif (curlen == nextlen)
        max_count = 6
        min_count = 3
      else
        max_count = 7
        min_count = 4
      end
    end
  end
def scan_tree ( s , tree , max_code ) prevlen = - 1 nextlen = tree [ 0 ] . dl count = 0 max_count = 7 min_count = 4 if nextlen == 0 max_count = 138 min_count = 3 end tree [ max_code + 1 ] . dl = 0xffff for n in 0 .. max_code curlen = nextlen nextlen = tree [ n + 1 ] . dl count += 1 if ( count < max_count ) && ( curlen == nextlen ) next elsif ( count < min_count ) s . bl_tree [ curlen ] . fc += count elsif curlen != 0 if ( curlen != prevlen ) s . bl_tree [ curlen ] . fc += 1 end s . bl_tree [ REP_3_6 ] . fc += 1 elsif ( count <= 10 ) s . bl_tree [ REPZ_3_10 ] . fc += 1 else s . bl_tree [ REPZ_11_138 ] . fc += 1 end count = 0 prevlen = curlen if nextlen == 0 max_count = 138 min_count = 3 elsif ( curlen == nextlen ) max_count = 6 min_count = 3 else max_count = 7 min_count = 4 end end end
Scan a literal or distance tree to determine the frequencies of the codes
in the bit length tree.
Scan a literal or distance tree to determine the frequencies of the codes in the bit length tree .
s
<not_specific>
tree
<not_specific>
max_code
<not_specific>