コード例 #1
0
        public override object __hx_setField(string field, int hash, object @value, bool handleProperties)
        {
            unchecked {
                switch (hash)
                {
                case 1327133892:
                {
                    this.storage_ = ((uint[])(@value));
                    return(@value);
                }


                case 1934413114:
                {
                    this.storage_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 786269185:
                {
                    this.prev_byte2_ = ((uint)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 90195659:
                {
                    this.prev_byte_ = ((uint)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 1659886955:
                {
                    this.last_byte_bits_ = ((uint)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 1338359406:
                {
                    this.last_byte_ = ((uint)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 1854114270:
                {
                    this.saved_dist_cache_ = ((int[])(@value));
                    return(@value);
                }


                case 35939030:
                {
                    this.dist_cache_ = ((int[])(@value));
                    return(@value);
                }


                case 1044314085:
                {
                    this.last_processed_pos_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 282430831:
                {
                    this.last_flush_pos_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 537950791:
                {
                    this.last_insert_len_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 1358280002:
                {
                    this.num_literals_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 204352542:
                {
                    this.num_commands_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 1285881495:
                {
                    this.commands_ = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(@value)))));
                    return(@value);
                }


                case 770104548:
                {
                    this.cmd_buffer_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 194189137:
                {
                    this.literal_cost_mask_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 332919650:
                {
                    this.literal_cost_ = ((double[])(@value));
                    return(@value);
                }


                case 439261615:
                {
                    this.ringbuffer_ = ((global::encode.RingBuffer)(@value));
                    return(@value);
                }


                case 1752889312:
                {
                    this.input_pos_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 953005556:
                {
                    this.hash_type_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 502309127:
                {
                    this.hashers_ = ((global::encode.hash.Hashers)(@value));
                    return(@value);
                }


                case 812293353:
                {
                    this.max_backward_distance_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 1579213401:
                {
                    this.params_ = ((global::encode.encode.BrotliParams)(@value));
                    return(@value);
                }


                default:
                {
                    return(base.__hx_setField(field, hash, @value, handleProperties));
                }
                }
            }
        }
コード例 #2
0
ファイル: Hashers.cs プロジェクト: sguzman/BrotliHaxe
 public static void __hx_ctor_encode_hash_Hashers(global::encode.hash.Hashers __hx_this)
 {
 }
コード例 #3
0
        public static void CreateBackwardReferences(int num_bytes, int position, uint[] ringbuffer, int ringbuffer_mask, double[] literal_cost, int literal_cost_mask, int max_backward_limit, int quality, global::encode.hash.Hashers hashers, int hash_type, int[] dist_cache, global::Array <int> last_insert_len, global::Array <object> commands, int commands_off, global::Array <int> num_commands, global::Array <int> num_literals)
        {
            unchecked {
                if ((quality > 9))
                {
                    global::encode.hash.HashLongestMatch hasher = hashers.hash_h9;
                    if (((num_bytes >= 3) && (position >= 3)))
                    {
                        hasher.Store(ringbuffer, ((position - 3) & ringbuffer_mask), (position - 3));
                        hasher.Store(ringbuffer, ((position - 2) & ringbuffer_mask), (position - 2));
                        hasher.Store(ringbuffer, ((position - 1) & ringbuffer_mask), (position - 1));
                    }

                    int[] num_matches = global::FunctionMalloc.mallocInt(num_bytes);
                    global::Array <object> matches = global::FunctionMalloc.mallocArray_encode_hash_BackwardMatch(typeof(global::encode.hash.BackwardMatch), (3 * num_bytes));
                    int cur_match_pos = 0;
                    int i             = 0;
                    while (((i + 3) < num_bytes))
                    {
                        int max_distance = ((int)(global::System.Math.Min(((double)((position + i))), ((double)(max_backward_limit)))));
                        if ((matches.length < (cur_match_pos + 325)))
                        {
                            matches.concat(global::FunctionMalloc.mallocArray_encode_hash_BackwardMatch(typeof(global::encode.hash.BackwardMatch), ((cur_match_pos + 325) - matches.length)));
                        }

                        hasher.FindAllMatches(ringbuffer, ringbuffer_mask, ((uint)((position + i))), ((uint)((num_bytes - i))), ((uint)(max_distance)), num_matches, i, matches, cur_match_pos);
                        hasher.Store(ringbuffer, ((position + i) & ringbuffer_mask), (position + i));
                        cur_match_pos += ((int)(((int[])(num_matches))[i]));
                        if ((((int)(((int[])(num_matches))[i])) == 1))
                        {
                            int match_len = ((global::encode.hash.BackwardMatch)(matches[(cur_match_pos - 1)])).length();
                            if ((match_len > 325))
                            {
                                int _g1 = 1;
                                while ((_g1 < match_len))
                                {
                                    ++_g1;
                                    ++i;
                                    hasher.Store(ringbuffer, ((position + i) & ringbuffer_mask), (position + i));
                                    ((int[])(num_matches))[i] = 0;
                                }
                            }
                        }

                        ++i;
                    }

                    int   orig_num_literals    = num_literals[0];
                    int   orig_last_insert_len = last_insert_len[0];
                    int[] orig_dist_cache      = ((int[])(new int[4]));
                    ((int[])(orig_dist_cache))[0] = ((int)(((int[])(dist_cache))[0]));
                    ((int[])(orig_dist_cache))[1] = ((int)(((int[])(dist_cache))[1]));
                    ((int[])(orig_dist_cache))[2] = ((int)(((int[])(dist_cache))[2]));
                    ((int[])(orig_dist_cache))[3] = ((int)(((int[])(dist_cache))[3]));
                    int orig_num_commands = num_commands[0];
                    {
                        int _g11 = 0;
                        while ((_g11 < 2))
                        {
                            global::encode.backward_references.ZopfliCostModel model = new global::encode.backward_references.ZopfliCostModel();
                            if ((_g11++ == 0))
                            {
                                model.SetFromLiteralCosts(num_bytes, position, literal_cost, literal_cost_mask);
                            }
                            else
                            {
                                model.SetFromCommands(num_bytes, position, ringbuffer, ringbuffer_mask, commands, ((commands_off + num_commands[0]) - orig_num_commands), orig_last_insert_len);
                            }

                            num_commands[0]    = orig_num_commands;
                            num_literals[0]    = orig_num_literals;
                            last_insert_len[0] = orig_last_insert_len;
                            global::DefaultFunctions.memcpy_Int(dist_cache, 0, orig_dist_cache, 0, 4);
                            global::encode.Backward_references.ZopfliIterate(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, model, num_matches, matches, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                        }
                    }

                    return;
                }

                switch (hash_type)
                {
                case 1:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatchQuickly(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h1, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 2:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatchQuickly(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h2, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 3:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatchQuickly(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h3, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 4:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatchQuickly(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h4, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 5:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatch(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h5, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 6:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatch(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h6, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 7:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatch(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h7, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 8:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatch(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h8, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                case 9:
                {
                    global::encode.Backward_references.CreateBackwardReferences_HashLongestMatch(num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit, quality, hashers.hash_h9, dist_cache, last_insert_len, commands, commands_off, num_commands, num_literals);
                    break;
                }


                default:
                {
                    break;
                }
                }
            }
        }