• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.5.8/xnu-1228.15.4/libkern/

Lines Matching defs:heap

333 /* maximum heap size */
485 int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
486 int heap_len; /* number of elements in the heap */
488 /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
489 * The same heap array is used to build all trees.
2038 * need for the L_CODES extra codes used during heap construction. However
2531 /* Index within the heap array of least frequent node in the Huffman tree */
2535 * Remove the smallest element from the heap and recreate the heap with
2536 * one less element. Updates heap and heap_len.
2540 top = s->heap[SMALLEST]; \
2541 s->heap[SMALLEST] = s->heap[s->heap_len--]; \
2554 * Restore the heap property by moving down the tree starting at node k,
2556 * when the heap property is re-established (each father smaller than its
2564 int v = s->heap[k];
2569 smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
2573 if (smaller(tree, v, s->heap[j], s->depth)) break;
2576 s->heap[k] = s->heap[j]; k = j;
2581 s->heap[k] = v;
2587 * IN assertion: the fields freq and dad are set, heap[heap_max] and
2603 int h; /* heap index */
2615 tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
2618 n = s->heap[h];
2659 m = s->heap[--h];
2730 int n, m; /* iterate over heap elements */
2734 /* Construct the initial heap, with least frequent element in
2735 * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
2736 * heap[0] is not used.
2742 s->heap[++(s->heap_len)] = max_code = n;
2755 node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
2763 /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
2774 m = s->heap[SMALLEST]; /* m = node of next least frequency */
2776 s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
2777 s->heap[--(s->heap_max)] = m;
2789 /* and insert the new node in the heap */
2790 s->heap[SMALLEST] = node++;
2795 s->heap[--(s->heap_max)] = s->heap[SMALLEST];