public static void StoreBlockSwitch(global::encode.brotli_bit_stream.BlockSplitCode code, int block_ix, global::Array <int> storage_ix, uint[] storage) { if ((block_ix > 0)) { int typecode = ((int[])(code.type_code))[block_ix]; global::encode.Write_bits.WriteBits(((int)(((uint[])(code.type_depths))[typecode])), ((uint[])(code.type_bits))[typecode], storage_ix, storage); } int lencode = ((int[])(code.length_prefix))[block_ix]; global::encode.Write_bits.WriteBits(((int)(((uint[])(code.length_depths))[lencode])), ((uint[])(code.length_bits))[lencode], storage_ix, storage); global::encode.Write_bits.WriteBits(((int[])(code.length_nextra))[block_ix], ((uint)(((int[])(code.length_extra))[block_ix])), storage_ix, storage); }
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) { unchecked { switch (hash) { case 855943833: { this.bits_ = ((uint[])(@value)); return(@value); } case 1783290959: { this.depths_ = ((uint[])(@value)); return(@value); } case 1073261442: { this.entropy_ix_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1056398940: { this.block_len_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1506867806: { this.block_ix_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 793152251: { this.block_split_code_ = ((global::encode.brotli_bit_stream.BlockSplitCode)(@value)); return(@value); } case 302804836: { this.block_lengths_ = ((global::Array <int>)(global::Array <object> .__hx_cast <int>(((global::Array)(@value))))); return(@value); } case 713460152: { this.block_types_ = ((global::Array <int>)(global::Array <object> .__hx_cast <int>(((global::Array)(@value))))); return(@value); } case 510872209: { this.num_block_types_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1291834546: { this.alphabet_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } default: { return(base.__hx_setField(field, hash, @value, handleProperties)); } } } }
public static void BuildAndStoreBlockSplitCode(global::Array <int> types, global::Array <int> lengths, int num_types, global::encode.brotli_bit_stream.BlockSplitCode code, global::Array <int> storage_ix, uint[] storage) { unchecked { int num_blocks = types.length; int[] type_histo = global::FunctionMalloc.mallocInt((num_types + 2)); int[] length_histo = global::FunctionMalloc.mallocInt(26); int last_type = 1; int second_last_type = 0; code.type_code = global::FunctionMalloc.mallocInt(num_blocks); code.length_prefix = global::FunctionMalloc.mallocInt(num_blocks); code.length_nextra = global::FunctionMalloc.mallocInt(num_blocks); code.length_extra = global::FunctionMalloc.mallocInt(num_blocks); code.type_depths = global::FunctionMalloc.mallocUInt((num_types + 2)); code.type_bits = global::FunctionMalloc.mallocUInt((num_types + 2)); code.length_depths = global::FunctionMalloc.mallocUInt(26); code.length_bits = global::FunctionMalloc.mallocUInt(26); { int _g1 = 0; while ((_g1 < num_blocks)) { int i = _g1++; int type = types[i]; int type_code = (((type == (last_type + 1))) ? (1) : ((((type == second_last_type)) ? (0) : ((type + 2))))); second_last_type = last_type; last_type = type; ((int[])(code.type_code))[i] = type_code; if ((i > 0)) { int _g2 = type_code; ((int[])(type_histo))[_g2] = (((int)(((int[])(type_histo))[_g2])) + 1); } global::encode.Prefix.GetBlockLengthPrefixCode(lengths[i], code.length_prefix, i, code.length_nextra, i, code.length_extra, i); { int _g21 = ((int[])(code.length_prefix))[i]; ((int[])(length_histo))[_g21] = (((int)(((int[])(length_histo))[_g21])) + 1); } } } global::encode.Brotli_bit_stream.StoreVarLenUint8((num_types - 1), storage_ix, storage); if ((num_types > 1)) { global::encode.Brotli_bit_stream.BuildAndStoreHuffmanTree(type_histo, (num_types + 2), code.type_depths, 0, code.type_bits, 0, storage_ix, storage); global::encode.Brotli_bit_stream.BuildAndStoreHuffmanTree(length_histo, 26, code.length_depths, 0, code.length_bits, 0, storage_ix, storage); global::encode.Brotli_bit_stream.StoreBlockSwitch(code, 0, storage_ix, storage); } } }
public static void __hx_ctor_encode_brotli_bit_stream_BlockSplitCode(global::encode.brotli_bit_stream.BlockSplitCode __hx_this) { }