lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
# Restore the heap property by moving down the tree starting at node k,
# exchanging a node with the smallest of its two sons if necessary, stopping
# when the heap property is re-established (each father smaller than its
# two sons).
Restore the heap property by moving down the tree starting at node k,
exchanging a node with the smallest of its two sons if necessary, stopping
when the heap property is re-established (each father smaller than its
two sons).
Restore the heap property by moving down the tree starting at node k exchanging a node with the smallest of its two sons if necessary stopping when the heap property is re - established ( each father smaller than its two sons ) .
def pqdownheap(s,tree,k)
    v = s.heap[k]
    j = k << 1
    while (j <= s.heap_len)
      if (j < s.heap_len) &&
        ( (tree[s.heap[j+1]].fc < tree[s.heap[j]].fc) ||
        ((tree[s.heap[j+1]].fc == tree[s.heap[j]].fc) &&
         (s.depth[s.heap[j+1]] <= s.depth[s.heap[j]])) )
        j+=1
      end
      break if ( (tree[v].fc < tree[s.heap[j]].fc) ||
         ((tree[v].fc == tree[s.heap[j]].fc) &&
          (s.depth[v] <= s.depth[s.heap[j]])) )
      s.heap[k] = s.heap[j]
      k = j
      j <<= 1
    end
    s.heap[k] = v
  end
def pqdownheap ( s , tree , k ) v = s . heap [ k ] j = k << 1 while ( j <= s . heap_len ) if ( j < s . heap_len ) && ( ( tree [ s . heap [ j + 1 ] ] . fc < tree [ s . heap [ j ] ] . fc ) || ( ( tree [ s . heap [ j + 1 ] ] . fc == tree [ s . heap [ j ] ] . fc ) && ( s . depth [ s . heap [ j + 1 ] ] <= s . depth [ s . heap [ j ] ] ) ) ) j += 1 end break if ( ( tree [ v ] . fc < tree [ s . heap [ j ] ] . fc ) || ( ( tree [ v ] . fc == tree [ s . heap [ j ] ] . fc ) && ( s . depth [ v ] <= s . depth [ s . heap [ j ] ] ) ) ) s . heap [ k ] = s . heap [ j ] k = j j <<= 1 end s . heap [ k ] = v end
Restore the heap property by moving down the tree starting at node k,
exchanging a node with the smallest of its two sons if necessary, stopping
when the heap property is re-established (each father smaller than its
two sons).
Restore the heap property by moving down the tree starting at node k exchanging a node with the smallest of its two sons if necessary stopping when the heap property is re - established ( each father smaller than its two sons ) .
s
<not_specific>
tree
<not_specific>
k
<not_specific>