_IsSmaller() static private method

static private _IsSmaller ( short tree, int n, int m, sbyte depth ) : bool
tree short
n int
m int
depth sbyte
return bool
Beispiel #1
0
        internal void pqdownheap(short[] tree, int k)
        {
            int num = this.heap[k];

            for (int i = k << 1; i <= this.heap_len; i <<= 1)
            {
                if (i < this.heap_len && DeflateManager._IsSmaller(tree, this.heap[i + 1], this.heap[i], this.depth))
                {
                    i++;
                }
                if (DeflateManager._IsSmaller(tree, num, this.heap[i], this.depth))
                {
                    break;
                }
                this.heap[k] = this.heap[i];
                k            = i;
            }
            this.heap[k] = num;
        }
Beispiel #2
0
        internal void pqdownheap(short[] tree, int k)
        {
            int num  = this.heap[k];
            int num2 = k << 1;

            while (num2 <= this.heap_len)
            {
                if (num2 < this.heap_len && DeflateManager._IsSmaller(tree, this.heap[num2 + 1], this.heap[num2], this.depth))
                {
                    num2++;
                }
                if (!DeflateManager._IsSmaller(tree, num, this.heap[num2], this.depth))
                {
                    this.heap[k] = this.heap[num2];
                    k            = num2;
                    num2       <<= 1;
                    continue;
                }
                break;
            }
            this.heap[k] = num;
        }