local void pqdownheap(s, tree, k)
    deflate_state *s;
    ct_data *tree;  /* the tree to restore */
    int k;               /* node to move down */
{
    int v = s->heap[k];
    int j = k << 1;  /* left son of k */
    while (j <= s->heap_len) {
        /* Set j to the smallest of the two sons: */
        if (j < s->heap_len &&
            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
            j++;
        }
        /* Exit if v is smaller than both sons */
        if (smaller(tree, v, s->heap[j], s->depth)) break;

        /* Exchange v with the smallest son */
        s->heap[k] = s->heap[j];  k = j;

        /* And continue down the tree, setting j to the left son of k */
        j <<= 1;
    }
    s->heap[k] = v;
}
local void pqdownheap(s, tree, k)
    deflate_state *s;
    ct_data *tree;   
    int k;                
{
    int v = s->heap[k];
    int j = k << 1;   
    while (j <= s->heap_len) {
         
        if (j < s->heap_len &&
            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
            j++;
        }
         
        if (smaller(tree, v, s->heap[j], s->depth)) break;

         
        s->heap[k] = s->heap[j];  k = j;

         
        j <<= 1;
    }
    s->heap[k] = v;
}