lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
# Send a literal or distance tree in compressed form, using the codes in
# bl_tree.
Send a literal or distance tree in compressed form, using the codes in
bl_tree.
Send a literal or distance tree in compressed form using the codes in bl_tree .
def send_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
    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)
        loop do
          send_bits(s, s.bl_tree[curlen].fc, s.bl_tree[curlen].dl)
          count-=1
          break if count == 0
        end
      elsif curlen != 0
        if (curlen != prevlen)
          send_bits(s, s.bl_tree[curlen].fc, s.bl_tree[curlen].dl)
          count-=1
        end
        send_bits(s, s.bl_tree[REP_3_6].fc, s.bl_tree[REP_3_6].dl)
        send_bits(s, count-3, 2)
      elsif (count <= 10)
        send_bits(s, s.bl_tree[REPZ_3_10].fc, s.bl_tree[REPZ_3_10].dl)
        send_bits(s, count-3, 3)
      else
        send_bits(s, s.bl_tree[REPZ_11_138].fc, s.bl_tree[REPZ_11_138].dl)
        send_bits(s, count-11, 7)
      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 send_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 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 ) loop do send_bits ( s , s . bl_tree [ curlen ] . fc , s . bl_tree [ curlen ] . dl ) count -= 1 break if count == 0 end elsif curlen != 0 if ( curlen != prevlen ) send_bits ( s , s . bl_tree [ curlen ] . fc , s . bl_tree [ curlen ] . dl ) count -= 1 end send_bits ( s , s . bl_tree [ REP_3_6 ] . fc , s . bl_tree [ REP_3_6 ] . dl ) send_bits ( s , count - 3 , 2 ) elsif ( count <= 10 ) send_bits ( s , s . bl_tree [ REPZ_3_10 ] . fc , s . bl_tree [ REPZ_3_10 ] . dl ) send_bits ( s , count - 3 , 3 ) else send_bits ( s , s . bl_tree [ REPZ_11_138 ] . fc , s . bl_tree [ REPZ_11_138 ] . dl ) send_bits ( s , count - 11 , 7 ) 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
Send a literal or distance tree in compressed form, using the codes in
bl_tree.
Send a literal or distance tree in compressed form using the codes in bl_tree .
s
<not_specific>
tree
<not_specific>
max_code
<not_specific>