// Token: 0x0600077A RID: 1914 RVA: 0x00033278 File Offset: 0x00031478 internal void build_tree(Class_190 s) { short[] array = this.dyn_tree; short[] treeCodes = this.staticTree.treeCodes; int elems = this.staticTree.elems; int num = -1; s.heap_len = 0; s.heap_max = Class_200.HEAP_SIZE; for (int i = 0; i < elems; i++) { if (array[i * 2] != 0) { num = (s.heap[++s.heap_len] = i); s.depth[i] = 0; } else { array[i * 2 + 1] = 0; } } int num2; while (s.heap_len < 2) { num2 = (s.heap[++s.heap_len] = ((num < 2) ? (++num) : 0)); array[num2 * 2] = 1; s.depth[num2] = 0; s.opt_len--; if (treeCodes != null) { s.static_len -= (int)treeCodes[num2 * 2 + 1]; } } this.max_code = num; for (int i = s.heap_len / 2; i >= 1; i--) { s.pqdownheap(array, i); } num2 = elems; do { int i = s.heap[1]; s.heap[1] = s.heap[s.heap_len--]; s.pqdownheap(array, 1); int num3 = s.heap[1]; s.heap[--s.heap_max] = i; s.heap[--s.heap_max] = num3; array[num2 * 2] = array[i * 2] + array[num3 * 2]; s.depth[num2] = (sbyte)(Math.Max((byte)s.depth[i], (byte)s.depth[num3]) + 1); array[i * 2 + 1] = (array[num3 * 2 + 1] = (short)num2); s.heap[1] = num2++; s.pqdownheap(array, 1); }while (s.heap_len >= 2); s.heap[--s.heap_max] = s.heap[1]; this.gen_bitlen(s); Class_200.gen_codes(array, num, s.bl_count); }
// Token: 0x0600077B RID: 1915 RVA: 0x000334D4 File Offset: 0x000316D4 internal static void gen_codes(short[] tree, int max_code, short[] bl_count) { short[] array = new short[Class_207.MAX_BITS + 1]; short num = 0; for (int i = 1; i <= Class_207.MAX_BITS; i++) { num = (array[i] = (short)(num + bl_count[i - 1] << 1)); } for (int j = 0; j <= max_code; j++) { int num2 = (int)tree[j * 2 + 1]; if (num2 != 0) { int num3 = j * 2; short[] array2 = array; int num4 = num2; short code; array2[num4] = (code = array2[num4]) + 1; tree[num3] = (short)Class_200.bi_reverse((int)code, num2); } } }