/src/rust-brotli/src/enc/backward_references/mod.rs
Line | Count | Source |
1 | | mod benchmark; |
2 | | pub mod hash_to_binary_tree; |
3 | | pub mod hq; |
4 | | mod test; |
5 | | |
6 | | use core::cmp::{max, min}; |
7 | | |
8 | | use super::super::alloc::{Allocator, SliceWrapper, SliceWrapperMut}; |
9 | | use super::command::{BrotliDistanceParams, Command, ComputeDistanceCode}; |
10 | | use super::dictionary_hash::kStaticDictionaryHash; |
11 | | use super::hash_to_binary_tree::{H10Buckets, H10DefaultParams, ZopfliNode, H10}; |
12 | | use super::static_dict::{ |
13 | | BrotliDictionary, FindMatchLengthWithLimit, FindMatchLengthWithLimitMin4, |
14 | | BROTLI_UNALIGNED_LOAD32, BROTLI_UNALIGNED_LOAD64, |
15 | | }; |
16 | | use super::util::{floatX, Log2FloorNonZero}; |
17 | | use crate::enc::combined_alloc::allocate; |
18 | | |
19 | | pub static kInvalidMatch: u32 = 0x0fff_ffff; |
20 | | static kCutoffTransformsCount: u32 = 10; |
21 | | static kCutoffTransforms: u64 = 0x071b_520a_da2d_3200; |
22 | | pub static kHashMul32: u32 = 0x1e35_a7bd; |
23 | | pub static kHashMul64: u64 = 0x1e35_a7bd_1e35_a7bd; |
24 | | pub static kHashMul64Long: u64 = 0x1fe3_5a7b_d357_9bd3; |
25 | | |
26 | | #[derive(PartialEq, Eq, Copy, Clone, Debug)] |
27 | | #[repr(C)] |
28 | | pub enum BrotliEncoderMode { |
29 | | BROTLI_MODE_GENERIC = 0, |
30 | | BROTLI_MODE_TEXT = 1, |
31 | | BROTLI_MODE_FONT = 2, |
32 | | BROTLI_FORCE_LSB_PRIOR = 3, |
33 | | BROTLI_FORCE_MSB_PRIOR = 4, |
34 | | BROTLI_FORCE_UTF8_PRIOR = 5, |
35 | | BROTLI_FORCE_SIGNED_PRIOR = 6, |
36 | | } |
37 | | |
38 | | /// This code takes a length and checks if there's an "end of dictionary" marker at the |
39 | | /// "ring_buffer_break"point. This marks where a backwards reference cannot pull data through. |
40 | | /// A match must stop at the end of the dictionary and cannot span the end of the dictionary |
41 | | /// and beginning of the file. ring_buffer_break is only set true for custom LZ77 dictionary. |
42 | 1.27G | fn fix_unbroken_len( |
43 | 1.27G | unbroken_len: usize, |
44 | 1.27G | prev_ix: usize, |
45 | 1.27G | _cur_ix_masked: usize, |
46 | 1.27G | ring_buffer_break: Option<core::num::NonZeroUsize>, |
47 | 1.27G | ) -> usize { |
48 | 1.27G | if let Some(br) = ring_buffer_break { |
49 | 0 | if prev_ix < usize::from(br) && prev_ix + unbroken_len > usize::from(br) { |
50 | 0 | return usize::from(br) - prev_ix; |
51 | 0 | } |
52 | 1.27G | } |
53 | 1.27G | return unbroken_len; |
54 | 1.27G | } |
55 | | #[derive(Clone, Copy, Debug, PartialEq)] |
56 | | pub struct BrotliHasherParams { |
57 | | /// type of hasher to use (default: type 6, but others have tradeoffs of speed/memory) |
58 | | pub type_: i32, |
59 | | /// number of the number of buckets to have in the hash table (defaults to quality - 1) |
60 | | pub bucket_bits: i32, |
61 | | /// number of potential matches to hold per bucket (hash collisions) |
62 | | pub block_bits: i32, |
63 | | /// number of bytes of a potential match to hash |
64 | | pub hash_len: i32, |
65 | | /// number of previous distance matches to check for future matches (defaults to 16) |
66 | | pub num_last_distances_to_check: i32, |
67 | | /// how much to weigh distance vs an extra byte of copy match when comparing possible copy srcs |
68 | | pub literal_byte_score: i32, |
69 | | } |
70 | | |
71 | | #[derive(Clone, Debug)] |
72 | | pub struct BrotliEncoderParams { |
73 | | pub dist: BrotliDistanceParams, |
74 | | /// if this brotli file is generic, font or specifically text |
75 | | pub mode: BrotliEncoderMode, |
76 | | /// quality param between 0 and 11 (11 is smallest but takes longest to encode) |
77 | | pub quality: i32, |
78 | | pub q9_5: bool, |
79 | | /// log of how big the ring buffer should be for copying prior data |
80 | | pub lgwin: i32, |
81 | | /// log of how often metablocks should be serialized |
82 | | pub lgblock: i32, |
83 | | /// how big the source file is (or 0 if no hint is provided) |
84 | | pub size_hint: usize, |
85 | | // FIXME: this should be bool |
86 | | /// avoid serializing out priors for literal sections in the favor of decode speed |
87 | | pub disable_literal_context_modeling: i32, |
88 | | pub hasher: BrotliHasherParams, |
89 | | /// produce an IR of the compression file |
90 | | pub log_meta_block: bool, |
91 | | /// attempt to detect how many bytes before the current byte generates the best prediction of it |
92 | | /// * 0 = off (stride 1 always) |
93 | | /// * 1 = on per 16th of a file |
94 | | /// * 2 = on per block type switch |
95 | | pub stride_detection_quality: u8, |
96 | | /// if nonzero, will search for high entropy strings and log them differently to the IR |
97 | | pub high_entropy_detection_quality: u8, |
98 | | /// if nonzero it will search for the temporal locality and effectiveness of the priors |
99 | | /// for literals. The best adaptation and forgetfulness will be logged per metablock to the IR |
100 | | pub cdf_adaptation_detection: u8, |
101 | | /// whether to search for whether the previous byte or the context_map are better predictors on a per-context-map basis |
102 | | pub prior_bitmask_detection: u8, |
103 | | /// for prior bitmask detection: stride_low, stride_speed, cm_low, cm_speed |
104 | | pub literal_adaptation: [(u16, u16); 4], |
105 | | pub large_window: bool, |
106 | | /// avoid search for the best ndirect vs npostfix parameters for distance |
107 | | pub avoid_distance_prefix_search: bool, |
108 | | /// inserts an extra empty metadata block before the final empty metablock in |
109 | | /// catable/appendable mode so concatination tools can just remove the last byte |
110 | | pub byte_align: bool, |
111 | | /// do not emit a empty last block at end of data - if not appendable, this |
112 | | /// will also supress the stream header |
113 | | pub bare_stream: bool, |
114 | | /// construct brotli in such a way that it may be concatenated with another brotli file using appropriate bit ops |
115 | | pub catable: bool, |
116 | | /// can use the dictionary (default yes unless catable is set) |
117 | | pub use_dictionary: bool, |
118 | | /// construct brotli in such a way that another concatable brotli file may be appended |
119 | | pub appendable: bool, |
120 | | /// include a magic number and version number and size_hint at the beginning |
121 | | pub magic_number: bool, |
122 | | /// prefer to compute the map of previously seen strings |
123 | | /// just once for all the threads at the beginning, since they overlap significantly |
124 | | pub favor_cpu_efficiency: bool, |
125 | | } |
126 | | |
127 | | impl Default for BrotliEncoderParams { |
128 | 0 | fn default() -> BrotliEncoderParams { |
129 | 0 | super::encode::BrotliEncoderInitParams() |
130 | 0 | } |
131 | | } |
132 | | |
133 | | #[derive(Clone, Copy, Default, PartialEq)] |
134 | | pub struct H9Opts { |
135 | | pub literal_byte_score: u32, |
136 | | } |
137 | | pub enum HowPrepared { |
138 | | ALREADY_PREPARED, |
139 | | NEWLY_PREPARED, |
140 | | } |
141 | | #[derive(Clone, PartialEq)] |
142 | | pub struct Struct1 { |
143 | | pub params: BrotliHasherParams, |
144 | | /// FIXME: this should be bool |
145 | | pub is_prepared_: i32, |
146 | | pub dict_num_lookups: usize, |
147 | | pub dict_num_matches: usize, |
148 | | } |
149 | | |
150 | 7.90k | fn LiteralSpreeLengthForSparseSearch(params: &BrotliEncoderParams) -> usize { |
151 | 7.90k | (if params.quality < 9 { 64i32 } else { 512i32 }) as usize |
152 | 7.90k | } |
153 | | |
154 | | pub struct HasherSearchResult { |
155 | | pub len: usize, |
156 | | pub len_x_code: usize, |
157 | | pub distance: usize, |
158 | | pub score: u64, |
159 | | } |
160 | | |
161 | | pub trait CloneWithAlloc<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> { |
162 | | fn clone_with_alloc(&self, m: &mut Alloc) -> Self; |
163 | | } |
164 | | |
165 | | pub trait AnyHasher { |
166 | | fn Opts(&self) -> H9Opts; |
167 | | fn GetHasherCommon(&mut self) -> &mut Struct1; |
168 | | fn HashBytes(&self, data: &[u8]) -> usize; |
169 | | fn HashTypeLength(&self) -> usize; |
170 | | fn StoreLookahead(&self) -> usize; |
171 | | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]); |
172 | | fn FindLongestMatch( |
173 | | &mut self, |
174 | | dictionary: Option<&BrotliDictionary>, |
175 | | dictionary_hash: &[u16], |
176 | | data: &[u8], |
177 | | ring_buffer_mask: usize, |
178 | | ring_buffer_break: Option<core::num::NonZeroUsize>, |
179 | | distance_cache: &[i32], |
180 | | cur_ix: usize, |
181 | | max_length: usize, |
182 | | max_backward: usize, |
183 | | gap: usize, |
184 | | max_distance: usize, |
185 | | out: &mut HasherSearchResult, |
186 | | ) -> bool; |
187 | | fn Store(&mut self, data: &[u8], mask: usize, ix: usize); |
188 | 550k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { |
189 | 2.75M | for i in 0..4 { |
190 | 2.20M | self.Store(data, mask, ix + i * 4); |
191 | 2.20M | } |
192 | 550k | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 188 | 242k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 189 | 1.21M | for i in 0..4 { | 190 | 970k | self.Store(data, mask, ix + i * 4); | 191 | 970k | } | 192 | 242k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 188 | 147k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 189 | 737k | for i in 0..4 { | 190 | 590k | self.Store(data, mask, ix + i * 4); | 191 | 590k | } | 192 | 147k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 188 | 139k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 189 | 697k | for i in 0..4 { | 190 | 557k | self.Store(data, mask, ix + i * 4); | 191 | 557k | } | 192 | 139k | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 188 | 21.1k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 189 | 105k | for i in 0..4 { | 190 | 84.6k | self.Store(data, mask, ix + i * 4); | 191 | 84.6k | } | 192 | 21.1k | } |
Unexecuted instantiation: <_ as brotli::enc::backward_references::AnyHasher>::Store4Vec4 |
193 | 168k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { |
194 | 841k | for i in 0..4 { |
195 | 673k | self.Store(data, mask, ix + i * 2); |
196 | 673k | } |
197 | 168k | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 193 | 56.8k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 194 | 284k | for i in 0..4 { | 195 | 227k | self.Store(data, mask, ix + i * 2); | 196 | 227k | } | 197 | 56.8k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 193 | 27.4k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 194 | 137k | for i in 0..4 { | 195 | 109k | self.Store(data, mask, ix + i * 2); | 196 | 109k | } | 197 | 27.4k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 193 | 47.3k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 194 | 236k | for i in 0..4 { | 195 | 189k | self.Store(data, mask, ix + i * 2); | 196 | 189k | } | 197 | 47.3k | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 193 | 36.6k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 194 | 183k | for i in 0..4 { | 195 | 146k | self.Store(data, mask, ix + i * 2); | 196 | 146k | } | 197 | 36.6k | } |
Unexecuted instantiation: <_ as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 |
198 | | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize); |
199 | | fn BulkStoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize); |
200 | | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared; |
201 | | fn StitchToPreviousBlock( |
202 | | &mut self, |
203 | | num_bytes: usize, |
204 | | position: usize, |
205 | | ringbuffer: &[u8], |
206 | | ringbuffer_mask: usize, |
207 | | ); |
208 | | } |
209 | | |
210 | 7.90k | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( |
211 | 7.90k | handle: &mut T, |
212 | 7.90k | num_bytes: usize, |
213 | 7.90k | position: usize, |
214 | 7.90k | ringbuffer: &[u8], |
215 | 7.90k | ringbuffer_mask: usize, |
216 | 7.90k | ) { |
217 | 7.90k | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { |
218 | 2.94k | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); |
219 | 2.94k | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); |
220 | 2.94k | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); |
221 | 4.95k | } |
222 | 7.90k | } brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 210 | 2.08k | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 2.08k | handle: &mut T, | 212 | 2.08k | num_bytes: usize, | 213 | 2.08k | position: usize, | 214 | 2.08k | ringbuffer: &[u8], | 215 | 2.08k | ringbuffer_mask: usize, | 216 | 2.08k | ) { | 217 | 2.08k | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 1.44k | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 1.44k | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 1.44k | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 1.44k | } | 222 | 2.08k | } |
brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 210 | 1.29k | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 1.29k | handle: &mut T, | 212 | 1.29k | num_bytes: usize, | 213 | 1.29k | position: usize, | 214 | 1.29k | ringbuffer: &[u8], | 215 | 1.29k | ringbuffer_mask: usize, | 216 | 1.29k | ) { | 217 | 1.29k | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 762 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 762 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 762 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 762 | } | 222 | 1.29k | } |
brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 210 | 720 | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 720 | handle: &mut T, | 212 | 720 | num_bytes: usize, | 213 | 720 | position: usize, | 214 | 720 | ringbuffer: &[u8], | 215 | 720 | ringbuffer_mask: usize, | 216 | 720 | ) { | 217 | 720 | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 132 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 132 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 132 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 588 | } | 222 | 720 | } |
Unexecuted instantiation: brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>>> brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 210 | 637 | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 637 | handle: &mut T, | 212 | 637 | num_bytes: usize, | 213 | 637 | position: usize, | 214 | 637 | ringbuffer: &[u8], | 215 | 637 | ringbuffer_mask: usize, | 216 | 637 | ) { | 217 | 637 | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 87 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 87 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 87 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 550 | } | 222 | 637 | } |
brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 210 | 740 | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 740 | handle: &mut T, | 212 | 740 | num_bytes: usize, | 213 | 740 | position: usize, | 214 | 740 | ringbuffer: &[u8], | 215 | 740 | ringbuffer_mask: usize, | 216 | 740 | ) { | 217 | 740 | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 94 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 94 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 94 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 646 | } | 222 | 740 | } |
brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 210 | 1.14k | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 1.14k | handle: &mut T, | 212 | 1.14k | num_bytes: usize, | 213 | 1.14k | position: usize, | 214 | 1.14k | ringbuffer: &[u8], | 215 | 1.14k | ringbuffer_mask: usize, | 216 | 1.14k | ) { | 217 | 1.14k | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 303 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 303 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 303 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 840 | } | 222 | 1.14k | } |
brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 210 | 698 | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 698 | handle: &mut T, | 212 | 698 | num_bytes: usize, | 213 | 698 | position: usize, | 214 | 698 | ringbuffer: &[u8], | 215 | 698 | ringbuffer_mask: usize, | 216 | 698 | ) { | 217 | 698 | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 64 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 64 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 64 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 634 | } | 222 | 698 | } |
brotli::enc::backward_references::StitchToPreviousBlockInternal::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 210 | 588 | pub fn StitchToPreviousBlockInternal<T: AnyHasher>( | 211 | 588 | handle: &mut T, | 212 | 588 | num_bytes: usize, | 213 | 588 | position: usize, | 214 | 588 | ringbuffer: &[u8], | 215 | 588 | ringbuffer_mask: usize, | 216 | 588 | ) { | 217 | 588 | if num_bytes >= handle.HashTypeLength().wrapping_sub(1) && (position >= 3) { | 218 | 59 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(3)); | 219 | 59 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(2)); | 220 | 59 | handle.Store(ringbuffer, ringbuffer_mask, position.wrapping_sub(1)); | 221 | 529 | } | 222 | 588 | } |
Unexecuted instantiation: brotli::enc::backward_references::StitchToPreviousBlockInternal::<_> |
223 | | |
224 | 0 | pub fn StoreLookaheadThenStore<T: AnyHasher>(hasher: &mut T, size: usize, dict: &[u8]) { |
225 | 0 | let overlap = hasher.StoreLookahead().wrapping_sub(1); |
226 | 0 | if size > overlap { |
227 | 0 | hasher.BulkStoreRange(dict, usize::MAX, 0, size - overlap); |
228 | 0 | } |
229 | 0 | } |
230 | | |
231 | | pub trait BasicHashComputer { |
232 | | fn HashBytes(&self, data: &[u8]) -> u32; |
233 | | fn BUCKET_BITS(&self) -> i32; |
234 | | fn USE_DICTIONARY(&self) -> i32; |
235 | | fn BUCKET_SWEEP(&self) -> i32; |
236 | | } |
237 | | pub struct BasicHasher<Buckets: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> { |
238 | | pub GetHasherCommon: Struct1, |
239 | | pub buckets_: Buckets, |
240 | | pub h9_opts: H9Opts, |
241 | | } |
242 | | |
243 | | impl<A: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> PartialEq<BasicHasher<A>> |
244 | | for BasicHasher<A> |
245 | | { |
246 | 0 | fn eq(&self, other: &BasicHasher<A>) -> bool { |
247 | 0 | self.GetHasherCommon == other.GetHasherCommon |
248 | 0 | && self.h9_opts == other.h9_opts |
249 | 0 | && self.buckets_.slice() == other.buckets_.slice() |
250 | 0 | } |
251 | | } |
252 | | |
253 | | impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> BasicHasher<T> { |
254 | 765k | fn StoreRangeOptBasic( |
255 | 765k | &mut self, |
256 | 765k | data: &[u8], |
257 | 765k | mask: usize, |
258 | 765k | ix_start: usize, |
259 | 765k | ix_end: usize, |
260 | 765k | ) -> usize { |
261 | 765k | let lookahead = 8; |
262 | 765k | if ix_end >= ix_start + lookahead * 2 { |
263 | 163k | let chunk_count = (ix_end - ix_start) / 4; |
264 | 5.91M | for chunk_id in 0..chunk_count { |
265 | 5.91M | let i = (ix_start + chunk_id * 4) & mask; |
266 | 5.91M | let word11 = data.split_at(i).1.split_at(11).0; |
267 | 5.91M | let mixed0 = self.HashBytes(word11); |
268 | 5.91M | let mixed1 = self.HashBytes(word11.split_at(1).1); |
269 | 5.91M | let mixed2 = self.HashBytes(word11.split_at(2).1); |
270 | 5.91M | let mixed3 = self.HashBytes(word11.split_at(3).1); |
271 | 5.91M | let off: u32 = (i >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; |
272 | 5.91M | let offset0: usize = mixed0 + off as usize; |
273 | 5.91M | let offset1: usize = mixed1 + off as usize; |
274 | 5.91M | let offset2: usize = mixed2 + off as usize; |
275 | 5.91M | let offset3: usize = mixed3 + off as usize; |
276 | 5.91M | self.buckets_.slice_mut()[offset0] = i as u32; |
277 | 5.91M | self.buckets_.slice_mut()[offset1] = i as u32 + 1; |
278 | 5.91M | self.buckets_.slice_mut()[offset2] = i as u32 + 2; |
279 | 5.91M | self.buckets_.slice_mut()[offset3] = i as u32 + 3; |
280 | 5.91M | } |
281 | 163k | return ix_start + chunk_count * 4; |
282 | 602k | } |
283 | 602k | ix_start |
284 | 765k | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>>>::StoreRangeOptBasic Line | Count | Source | 254 | 387k | fn StoreRangeOptBasic( | 255 | 387k | &mut self, | 256 | 387k | data: &[u8], | 257 | 387k | mask: usize, | 258 | 387k | ix_start: usize, | 259 | 387k | ix_end: usize, | 260 | 387k | ) -> usize { | 261 | 387k | let lookahead = 8; | 262 | 387k | if ix_end >= ix_start + lookahead * 2 { | 263 | 67.1k | let chunk_count = (ix_end - ix_start) / 4; | 264 | 2.97M | for chunk_id in 0..chunk_count { | 265 | 2.97M | let i = (ix_start + chunk_id * 4) & mask; | 266 | 2.97M | let word11 = data.split_at(i).1.split_at(11).0; | 267 | 2.97M | let mixed0 = self.HashBytes(word11); | 268 | 2.97M | let mixed1 = self.HashBytes(word11.split_at(1).1); | 269 | 2.97M | let mixed2 = self.HashBytes(word11.split_at(2).1); | 270 | 2.97M | let mixed3 = self.HashBytes(word11.split_at(3).1); | 271 | 2.97M | let off: u32 = (i >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; | 272 | 2.97M | let offset0: usize = mixed0 + off as usize; | 273 | 2.97M | let offset1: usize = mixed1 + off as usize; | 274 | 2.97M | let offset2: usize = mixed2 + off as usize; | 275 | 2.97M | let offset3: usize = mixed3 + off as usize; | 276 | 2.97M | self.buckets_.slice_mut()[offset0] = i as u32; | 277 | 2.97M | self.buckets_.slice_mut()[offset1] = i as u32 + 1; | 278 | 2.97M | self.buckets_.slice_mut()[offset2] = i as u32 + 2; | 279 | 2.97M | self.buckets_.slice_mut()[offset3] = i as u32 + 3; | 280 | 2.97M | } | 281 | 67.1k | return ix_start + chunk_count * 4; | 282 | 319k | } | 283 | 319k | ix_start | 284 | 387k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>>>::StoreRangeOptBasic Line | Count | Source | 254 | 177k | fn StoreRangeOptBasic( | 255 | 177k | &mut self, | 256 | 177k | data: &[u8], | 257 | 177k | mask: usize, | 258 | 177k | ix_start: usize, | 259 | 177k | ix_end: usize, | 260 | 177k | ) -> usize { | 261 | 177k | let lookahead = 8; | 262 | 177k | if ix_end >= ix_start + lookahead * 2 { | 263 | 49.4k | let chunk_count = (ix_end - ix_start) / 4; | 264 | 1.55M | for chunk_id in 0..chunk_count { | 265 | 1.55M | let i = (ix_start + chunk_id * 4) & mask; | 266 | 1.55M | let word11 = data.split_at(i).1.split_at(11).0; | 267 | 1.55M | let mixed0 = self.HashBytes(word11); | 268 | 1.55M | let mixed1 = self.HashBytes(word11.split_at(1).1); | 269 | 1.55M | let mixed2 = self.HashBytes(word11.split_at(2).1); | 270 | 1.55M | let mixed3 = self.HashBytes(word11.split_at(3).1); | 271 | 1.55M | let off: u32 = (i >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; | 272 | 1.55M | let offset0: usize = mixed0 + off as usize; | 273 | 1.55M | let offset1: usize = mixed1 + off as usize; | 274 | 1.55M | let offset2: usize = mixed2 + off as usize; | 275 | 1.55M | let offset3: usize = mixed3 + off as usize; | 276 | 1.55M | self.buckets_.slice_mut()[offset0] = i as u32; | 277 | 1.55M | self.buckets_.slice_mut()[offset1] = i as u32 + 1; | 278 | 1.55M | self.buckets_.slice_mut()[offset2] = i as u32 + 2; | 279 | 1.55M | self.buckets_.slice_mut()[offset3] = i as u32 + 3; | 280 | 1.55M | } | 281 | 49.4k | return ix_start + chunk_count * 4; | 282 | 127k | } | 283 | 127k | ix_start | 284 | 177k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>>>::StoreRangeOptBasic Line | Count | Source | 254 | 201k | fn StoreRangeOptBasic( | 255 | 201k | &mut self, | 256 | 201k | data: &[u8], | 257 | 201k | mask: usize, | 258 | 201k | ix_start: usize, | 259 | 201k | ix_end: usize, | 260 | 201k | ) -> usize { | 261 | 201k | let lookahead = 8; | 262 | 201k | if ix_end >= ix_start + lookahead * 2 { | 263 | 46.7k | let chunk_count = (ix_end - ix_start) / 4; | 264 | 1.38M | for chunk_id in 0..chunk_count { | 265 | 1.38M | let i = (ix_start + chunk_id * 4) & mask; | 266 | 1.38M | let word11 = data.split_at(i).1.split_at(11).0; | 267 | 1.38M | let mixed0 = self.HashBytes(word11); | 268 | 1.38M | let mixed1 = self.HashBytes(word11.split_at(1).1); | 269 | 1.38M | let mixed2 = self.HashBytes(word11.split_at(2).1); | 270 | 1.38M | let mixed3 = self.HashBytes(word11.split_at(3).1); | 271 | 1.38M | let off: u32 = (i >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; | 272 | 1.38M | let offset0: usize = mixed0 + off as usize; | 273 | 1.38M | let offset1: usize = mixed1 + off as usize; | 274 | 1.38M | let offset2: usize = mixed2 + off as usize; | 275 | 1.38M | let offset3: usize = mixed3 + off as usize; | 276 | 1.38M | self.buckets_.slice_mut()[offset0] = i as u32; | 277 | 1.38M | self.buckets_.slice_mut()[offset1] = i as u32 + 1; | 278 | 1.38M | self.buckets_.slice_mut()[offset2] = i as u32 + 2; | 279 | 1.38M | self.buckets_.slice_mut()[offset3] = i as u32 + 3; | 280 | 1.38M | } | 281 | 46.7k | return ix_start + chunk_count * 4; | 282 | 154k | } | 283 | 154k | ix_start | 284 | 201k | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>>>::StoreRangeOptBasic Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_>>::StoreRangeOptBasic |
285 | | } |
286 | | pub struct H2Sub<AllocU32: alloc::Allocator<u32>> { |
287 | | pub buckets_: AllocU32::AllocatedMemory, // 65537 |
288 | | } |
289 | | impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher for BasicHasher<T> { |
290 | | #[inline(always)] |
291 | 6.74M | fn Opts(&self) -> H9Opts { |
292 | 6.74M | self.h9_opts |
293 | 6.74M | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 291 | 2.76M | fn Opts(&self) -> H9Opts { | 292 | 2.76M | self.h9_opts | 293 | 2.76M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 291 | 1.23M | fn Opts(&self) -> H9Opts { | 292 | 1.23M | self.h9_opts | 293 | 1.23M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 291 | 2.74M | fn Opts(&self) -> H9Opts { | 292 | 2.74M | self.h9_opts | 293 | 2.74M | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Opts Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::Opts |
294 | | #[allow(unused_variables)] |
295 | 546k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) {}<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 295 | 291k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) {} |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 295 | 129k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) {} |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 295 | 124k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) {} |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache |
296 | | #[inline(always)] |
297 | 4.73M | fn HashTypeLength(&self) -> usize { |
298 | 4.73M | 8 |
299 | 4.73M | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 297 | 2.37M | fn HashTypeLength(&self) -> usize { | 298 | 2.37M | 8 | 299 | 2.37M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 297 | 1.05M | fn HashTypeLength(&self) -> usize { | 298 | 1.05M | 8 | 299 | 1.05M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 297 | 1.30M | fn HashTypeLength(&self) -> usize { | 298 | 1.30M | 8 | 299 | 1.30M | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::HashTypeLength |
300 | | #[inline(always)] |
301 | 669k | fn StoreLookahead(&self) -> usize { |
302 | 669k | 8 |
303 | 669k | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 301 | 303k | fn StoreLookahead(&self) -> usize { | 302 | 303k | 8 | 303 | 303k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 301 | 177k | fn StoreLookahead(&self) -> usize { | 302 | 177k | 8 | 303 | 177k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 301 | 188k | fn StoreLookahead(&self) -> usize { | 302 | 188k | 8 | 303 | 188k | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::StoreLookahead |
304 | 4.09k | fn StitchToPreviousBlock( |
305 | 4.09k | &mut self, |
306 | 4.09k | num_bytes: usize, |
307 | 4.09k | position: usize, |
308 | 4.09k | ringbuffer: &[u8], |
309 | 4.09k | ringbuffer_mask: usize, |
310 | 4.09k | ) { |
311 | 4.09k | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); |
312 | 4.09k | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 304 | 2.08k | fn StitchToPreviousBlock( | 305 | 2.08k | &mut self, | 306 | 2.08k | num_bytes: usize, | 307 | 2.08k | position: usize, | 308 | 2.08k | ringbuffer: &[u8], | 309 | 2.08k | ringbuffer_mask: usize, | 310 | 2.08k | ) { | 311 | 2.08k | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); | 312 | 2.08k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 304 | 1.29k | fn StitchToPreviousBlock( | 305 | 1.29k | &mut self, | 306 | 1.29k | num_bytes: usize, | 307 | 1.29k | position: usize, | 308 | 1.29k | ringbuffer: &[u8], | 309 | 1.29k | ringbuffer_mask: usize, | 310 | 1.29k | ) { | 311 | 1.29k | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); | 312 | 1.29k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 304 | 720 | fn StitchToPreviousBlock( | 305 | 720 | &mut self, | 306 | 720 | num_bytes: usize, | 307 | 720 | position: usize, | 308 | 720 | ringbuffer: &[u8], | 309 | 720 | ringbuffer_mask: usize, | 310 | 720 | ) { | 311 | 720 | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); | 312 | 720 | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock |
313 | | #[inline(always)] |
314 | 1.26M | fn GetHasherCommon(&mut self) -> &mut Struct1 { |
315 | 1.26M | &mut self.GetHasherCommon |
316 | 1.26M | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 314 | 14.3k | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 315 | 14.3k | &mut self.GetHasherCommon | 316 | 14.3k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 314 | 1.57k | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 315 | 1.57k | &mut self.GetHasherCommon | 316 | 1.57k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 314 | 1.24M | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 315 | 1.24M | &mut self.GetHasherCommon | 316 | 1.24M | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon |
317 | | #[inline(always)] |
318 | 35.2M | fn HashBytes(&self, data: &[u8]) -> usize { |
319 | 35.2M | self.buckets_.HashBytes(data) as usize |
320 | 35.2M | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 318 | 17.5M | fn HashBytes(&self, data: &[u8]) -> usize { | 319 | 17.5M | self.buckets_.HashBytes(data) as usize | 320 | 17.5M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 318 | 9.04M | fn HashBytes(&self, data: &[u8]) -> usize { | 319 | 9.04M | self.buckets_.HashBytes(data) as usize | 320 | 9.04M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 318 | 8.62M | fn HashBytes(&self, data: &[u8]) -> usize { | 319 | 8.62M | self.buckets_.HashBytes(data) as usize | 320 | 8.62M | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::HashBytes Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::HashBytes |
321 | 6.05M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { |
322 | 6.05M | let (_, data_window) = data.split_at((ix & mask)); |
323 | 6.05M | let key: u32 = self.HashBytes(data_window) as u32; |
324 | 6.05M | let off: u32 = (ix >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; |
325 | 6.05M | self.buckets_.slice_mut()[key.wrapping_add(off) as usize] = ix as u32; |
326 | 6.05M | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 321 | 2.89M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 322 | 2.89M | let (_, data_window) = data.split_at((ix & mask)); | 323 | 2.89M | let key: u32 = self.HashBytes(data_window) as u32; | 324 | 2.89M | let off: u32 = (ix >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; | 325 | 2.89M | self.buckets_.slice_mut()[key.wrapping_add(off) as usize] = ix as u32; | 326 | 2.89M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 321 | 1.57M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 322 | 1.57M | let (_, data_window) = data.split_at((ix & mask)); | 323 | 1.57M | let key: u32 = self.HashBytes(data_window) as u32; | 324 | 1.57M | let off: u32 = (ix >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; | 325 | 1.57M | self.buckets_.slice_mut()[key.wrapping_add(off) as usize] = ix as u32; | 326 | 1.57M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 321 | 1.59M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 322 | 1.59M | let (_, data_window) = data.split_at((ix & mask)); | 323 | 1.59M | let key: u32 = self.HashBytes(data_window) as u32; | 324 | 1.59M | let off: u32 = (ix >> 3).wrapping_rem(self.buckets_.BUCKET_SWEEP() as usize) as u32; | 325 | 1.59M | self.buckets_.slice_mut()[key.wrapping_add(off) as usize] = ix as u32; | 326 | 1.59M | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Store Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::Store |
327 | 765k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { |
328 | 3.40M | for i in self.StoreRangeOptBasic(data, mask, ix_start, ix_end)..ix_end { |
329 | 3.40M | self.Store(data, mask, i); |
330 | 3.40M | } |
331 | 765k | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 327 | 387k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 328 | 1.68M | for i in self.StoreRangeOptBasic(data, mask, ix_start, ix_end)..ix_end { | 329 | 1.68M | self.Store(data, mask, i); | 330 | 1.68M | } | 331 | 387k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 327 | 177k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 328 | 872k | for i in self.StoreRangeOptBasic(data, mask, ix_start, ix_end)..ix_end { | 329 | 872k | self.Store(data, mask, i); | 330 | 872k | } | 331 | 177k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 327 | 201k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 328 | 844k | for i in self.StoreRangeOptBasic(data, mask, ix_start, ix_end)..ix_end { | 329 | 844k | self.Store(data, mask, i); | 330 | 844k | } | 331 | 201k | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::StoreRange Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::StoreRange |
332 | 0 | fn BulkStoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { |
333 | 0 | self.StoreRange(data, mask, ix_start, ix_end); |
334 | 0 | } |
335 | 2.34k | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { |
336 | 2.34k | if self.GetHasherCommon.is_prepared_ != 0 { |
337 | 2.34k | return HowPrepared::ALREADY_PREPARED; |
338 | 0 | } |
339 | 0 | let partial_prepare_threshold = (4 << self.buckets_.BUCKET_BITS()) >> 7; |
340 | 0 | if one_shot && input_size <= partial_prepare_threshold { |
341 | 0 | for i in 0..input_size { |
342 | 0 | let key = self.HashBytes(&data[i..]); |
343 | 0 | let bs = self.buckets_.BUCKET_SWEEP() as usize; |
344 | 0 | for item in self.buckets_.slice_mut()[key..(key + bs)].iter_mut() { |
345 | 0 | *item = 0; |
346 | 0 | } |
347 | | } |
348 | | } else { |
349 | 0 | for item in self.buckets_.slice_mut().iter_mut() { |
350 | 0 | *item = 0; |
351 | 0 | } |
352 | | } |
353 | 0 | self.GetHasherCommon.is_prepared_ = 1; |
354 | 0 | HowPrepared::NEWLY_PREPARED |
355 | 2.34k | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 335 | 1.44k | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 336 | 1.44k | if self.GetHasherCommon.is_prepared_ != 0 { | 337 | 1.44k | return HowPrepared::ALREADY_PREPARED; | 338 | 0 | } | 339 | 0 | let partial_prepare_threshold = (4 << self.buckets_.BUCKET_BITS()) >> 7; | 340 | 0 | if one_shot && input_size <= partial_prepare_threshold { | 341 | 0 | for i in 0..input_size { | 342 | 0 | let key = self.HashBytes(&data[i..]); | 343 | 0 | let bs = self.buckets_.BUCKET_SWEEP() as usize; | 344 | 0 | for item in self.buckets_.slice_mut()[key..(key + bs)].iter_mut() { | 345 | 0 | *item = 0; | 346 | 0 | } | 347 | | } | 348 | | } else { | 349 | 0 | for item in self.buckets_.slice_mut().iter_mut() { | 350 | 0 | *item = 0; | 351 | 0 | } | 352 | | } | 353 | 0 | self.GetHasherCommon.is_prepared_ = 1; | 354 | 0 | HowPrepared::NEWLY_PREPARED | 355 | 1.44k | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 335 | 764 | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 336 | 764 | if self.GetHasherCommon.is_prepared_ != 0 { | 337 | 764 | return HowPrepared::ALREADY_PREPARED; | 338 | 0 | } | 339 | 0 | let partial_prepare_threshold = (4 << self.buckets_.BUCKET_BITS()) >> 7; | 340 | 0 | if one_shot && input_size <= partial_prepare_threshold { | 341 | 0 | for i in 0..input_size { | 342 | 0 | let key = self.HashBytes(&data[i..]); | 343 | 0 | let bs = self.buckets_.BUCKET_SWEEP() as usize; | 344 | 0 | for item in self.buckets_.slice_mut()[key..(key + bs)].iter_mut() { | 345 | 0 | *item = 0; | 346 | 0 | } | 347 | | } | 348 | | } else { | 349 | 0 | for item in self.buckets_.slice_mut().iter_mut() { | 350 | 0 | *item = 0; | 351 | 0 | } | 352 | | } | 353 | 0 | self.GetHasherCommon.is_prepared_ = 1; | 354 | 0 | HowPrepared::NEWLY_PREPARED | 355 | 764 | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 335 | 135 | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 336 | 135 | if self.GetHasherCommon.is_prepared_ != 0 { | 337 | 135 | return HowPrepared::ALREADY_PREPARED; | 338 | 0 | } | 339 | 0 | let partial_prepare_threshold = (4 << self.buckets_.BUCKET_BITS()) >> 7; | 340 | 0 | if one_shot && input_size <= partial_prepare_threshold { | 341 | 0 | for i in 0..input_size { | 342 | 0 | let key = self.HashBytes(&data[i..]); | 343 | 0 | let bs = self.buckets_.BUCKET_SWEEP() as usize; | 344 | 0 | for item in self.buckets_.slice_mut()[key..(key + bs)].iter_mut() { | 345 | 0 | *item = 0; | 346 | 0 | } | 347 | | } | 348 | | } else { | 349 | 0 | for item in self.buckets_.slice_mut().iter_mut() { | 350 | 0 | *item = 0; | 351 | 0 | } | 352 | | } | 353 | 0 | self.GetHasherCommon.is_prepared_ = 1; | 354 | 0 | HowPrepared::NEWLY_PREPARED | 355 | 135 | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::Prepare Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::Prepare |
356 | | |
357 | 5.48M | fn FindLongestMatch( |
358 | 5.48M | &mut self, |
359 | 5.48M | dictionary: Option<&BrotliDictionary>, |
360 | 5.48M | dictionary_hash: &[u16], |
361 | 5.48M | data: &[u8], |
362 | 5.48M | ring_buffer_mask: usize, |
363 | 5.48M | ring_buffer_break: Option<core::num::NonZeroUsize>, |
364 | 5.48M | distance_cache: &[i32], |
365 | 5.48M | cur_ix: usize, |
366 | 5.48M | max_length: usize, |
367 | 5.48M | max_backward: usize, |
368 | 5.48M | gap: usize, |
369 | 5.48M | max_distance: usize, |
370 | 5.48M | out: &mut HasherSearchResult, |
371 | 5.48M | ) -> bool { |
372 | 5.48M | let opts = self.Opts(); |
373 | 5.48M | let best_len_in: usize = out.len; |
374 | 5.48M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; |
375 | 5.48M | let key: u32 = self.HashBytes(&data[cur_ix_masked..]) as u32; |
376 | 5.48M | let mut compare_char: i32 = data[cur_ix_masked.wrapping_add(best_len_in)] as i32; |
377 | 5.48M | let mut best_score: u64 = out.score; |
378 | 5.48M | let mut best_len: usize = best_len_in; |
379 | 5.48M | let cached_backward: usize = distance_cache[0] as usize; |
380 | 5.48M | let mut prev_ix: usize = cur_ix.wrapping_sub(cached_backward); |
381 | 5.48M | let mut is_match_found = false; |
382 | 5.48M | out.len_x_code = 0usize; |
383 | 5.48M | if prev_ix < cur_ix { |
384 | 5.48M | prev_ix &= ring_buffer_mask as u32 as usize; |
385 | 5.48M | if compare_char == data[prev_ix.wrapping_add(best_len)] as i32 { |
386 | 811k | let unbroken_len: usize = FindMatchLengthWithLimitMin4( |
387 | 811k | &data[prev_ix..], |
388 | 811k | &data[cur_ix_masked..], |
389 | 811k | max_length, |
390 | | ); |
391 | 811k | if unbroken_len != 0 { |
392 | 243k | let len = |
393 | 243k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); |
394 | 243k | best_score = BackwardReferenceScoreUsingLastDistance(len, opts); |
395 | 243k | best_len = len; |
396 | 243k | out.len = len; |
397 | 243k | out.distance = cached_backward; |
398 | 243k | out.score = best_score; |
399 | 243k | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; |
400 | 243k | if self.buckets_.BUCKET_SWEEP() == 1i32 { |
401 | 105k | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; |
402 | 105k | return true; |
403 | 137k | } else { |
404 | 137k | is_match_found = true; |
405 | 137k | } |
406 | 568k | } |
407 | 4.67M | } |
408 | 6.02k | } |
409 | 5.38M | let bucket_sweep = self.buckets_.BUCKET_SWEEP(); |
410 | 5.38M | if bucket_sweep == 1i32 { |
411 | 2.64M | prev_ix = self.buckets_.slice()[key as usize] as usize; |
412 | 2.64M | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; |
413 | 2.64M | let backward: usize = cur_ix.wrapping_sub(prev_ix); |
414 | 2.64M | prev_ix &= ring_buffer_mask as u32 as usize; |
415 | 2.64M | if compare_char != data[prev_ix.wrapping_add(best_len_in)] as i32 { |
416 | 1.36M | return false; |
417 | 1.28M | } |
418 | 1.28M | if backward == 0usize || backward > max_backward { |
419 | 880k | return false; |
420 | 402k | } |
421 | 402k | let unbroken_len: usize = |
422 | 402k | FindMatchLengthWithLimitMin4(&data[prev_ix..], &data[cur_ix_masked..], max_length); |
423 | 402k | if unbroken_len != 0 { |
424 | 390k | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); |
425 | 390k | out.len = len; |
426 | 390k | out.distance = backward; |
427 | 390k | out.score = BackwardReferenceScore(len, backward, opts); |
428 | 390k | return true; |
429 | 12.3k | } |
430 | | } else { |
431 | 8.47M | for prev_ix_ref in |
432 | 2.73M | self.buckets_.slice().split_at(key as usize).1[..bucket_sweep as usize].iter() |
433 | | { |
434 | 8.47M | let mut prev_ix = *prev_ix_ref as usize; |
435 | 8.47M | let backward: usize = cur_ix.wrapping_sub(prev_ix); |
436 | 8.47M | prev_ix &= ring_buffer_mask as u32 as usize; |
437 | 8.47M | if compare_char != data[prev_ix.wrapping_add(best_len)] as i32 { |
438 | 4.81M | continue; |
439 | 3.66M | } |
440 | 3.66M | if backward == 0usize || backward > max_backward { |
441 | 3.10M | continue; |
442 | 560k | } |
443 | 560k | let unbroken_len = FindMatchLengthWithLimitMin4( |
444 | 560k | &data[prev_ix..], |
445 | 560k | &data[cur_ix_masked..], |
446 | 560k | max_length, |
447 | | ); |
448 | | |
449 | 560k | if unbroken_len != 0 { |
450 | 499k | let len = |
451 | 499k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); |
452 | 499k | let score: u64 = BackwardReferenceScore(len, backward, opts); |
453 | 499k | if best_score < score { |
454 | 443k | best_score = score; |
455 | 443k | best_len = len; |
456 | 443k | out.len = best_len; |
457 | 443k | out.distance = backward; |
458 | 443k | out.score = score; |
459 | 443k | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; |
460 | 443k | is_match_found = true; |
461 | 443k | } |
462 | 60.3k | } |
463 | | } |
464 | | } |
465 | 2.74M | if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found { |
466 | 1.25M | is_match_found = SearchInStaticDictionary( |
467 | 1.25M | dictionary.unwrap(), |
468 | 1.25M | dictionary_hash, |
469 | 1.25M | self, |
470 | 1.25M | &data[cur_ix_masked..], |
471 | 1.25M | max_length, |
472 | 1.25M | max_backward.wrapping_add(gap), |
473 | 1.25M | max_distance, |
474 | 1.25M | out, |
475 | 1.25M | true, |
476 | 1.25M | ); |
477 | 1.48M | } |
478 | 2.74M | self.buckets_.slice_mut() |
479 | 2.74M | [(key as usize).wrapping_add((cur_ix >> 3).wrapping_rem(bucket_sweep as usize))] = |
480 | 2.74M | cur_ix as u32; |
481 | 2.74M | is_match_found |
482 | 5.48M | } <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 357 | 2.75M | fn FindLongestMatch( | 358 | 2.75M | &mut self, | 359 | 2.75M | dictionary: Option<&BrotliDictionary>, | 360 | 2.75M | dictionary_hash: &[u16], | 361 | 2.75M | data: &[u8], | 362 | 2.75M | ring_buffer_mask: usize, | 363 | 2.75M | ring_buffer_break: Option<core::num::NonZeroUsize>, | 364 | 2.75M | distance_cache: &[i32], | 365 | 2.75M | cur_ix: usize, | 366 | 2.75M | max_length: usize, | 367 | 2.75M | max_backward: usize, | 368 | 2.75M | gap: usize, | 369 | 2.75M | max_distance: usize, | 370 | 2.75M | out: &mut HasherSearchResult, | 371 | 2.75M | ) -> bool { | 372 | 2.75M | let opts = self.Opts(); | 373 | 2.75M | let best_len_in: usize = out.len; | 374 | 2.75M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 375 | 2.75M | let key: u32 = self.HashBytes(&data[cur_ix_masked..]) as u32; | 376 | 2.75M | let mut compare_char: i32 = data[cur_ix_masked.wrapping_add(best_len_in)] as i32; | 377 | 2.75M | let mut best_score: u64 = out.score; | 378 | 2.75M | let mut best_len: usize = best_len_in; | 379 | 2.75M | let cached_backward: usize = distance_cache[0] as usize; | 380 | 2.75M | let mut prev_ix: usize = cur_ix.wrapping_sub(cached_backward); | 381 | 2.75M | let mut is_match_found = false; | 382 | 2.75M | out.len_x_code = 0usize; | 383 | 2.75M | if prev_ix < cur_ix { | 384 | 2.75M | prev_ix &= ring_buffer_mask as u32 as usize; | 385 | 2.75M | if compare_char == data[prev_ix.wrapping_add(best_len)] as i32 { | 386 | 399k | let unbroken_len: usize = FindMatchLengthWithLimitMin4( | 387 | 399k | &data[prev_ix..], | 388 | 399k | &data[cur_ix_masked..], | 389 | 399k | max_length, | 390 | | ); | 391 | 399k | if unbroken_len != 0 { | 392 | 105k | let len = | 393 | 105k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 394 | 105k | best_score = BackwardReferenceScoreUsingLastDistance(len, opts); | 395 | 105k | best_len = len; | 396 | 105k | out.len = len; | 397 | 105k | out.distance = cached_backward; | 398 | 105k | out.score = best_score; | 399 | 105k | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; | 400 | 105k | if self.buckets_.BUCKET_SWEEP() == 1i32 { | 401 | 105k | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; | 402 | 105k | return true; | 403 | 0 | } else { | 404 | 0 | is_match_found = true; | 405 | 0 | } | 406 | 294k | } | 407 | 2.35M | } | 408 | 2.21k | } | 409 | 2.64M | let bucket_sweep = self.buckets_.BUCKET_SWEEP(); | 410 | 2.64M | if bucket_sweep == 1i32 { | 411 | 2.64M | prev_ix = self.buckets_.slice()[key as usize] as usize; | 412 | 2.64M | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; | 413 | 2.64M | let backward: usize = cur_ix.wrapping_sub(prev_ix); | 414 | 2.64M | prev_ix &= ring_buffer_mask as u32 as usize; | 415 | 2.64M | if compare_char != data[prev_ix.wrapping_add(best_len_in)] as i32 { | 416 | 1.36M | return false; | 417 | 1.28M | } | 418 | 1.28M | if backward == 0usize || backward > max_backward { | 419 | 880k | return false; | 420 | 402k | } | 421 | 402k | let unbroken_len: usize = | 422 | 402k | FindMatchLengthWithLimitMin4(&data[prev_ix..], &data[cur_ix_masked..], max_length); | 423 | 402k | if unbroken_len != 0 { | 424 | 390k | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 425 | 390k | out.len = len; | 426 | 390k | out.distance = backward; | 427 | 390k | out.score = BackwardReferenceScore(len, backward, opts); | 428 | 390k | return true; | 429 | 12.3k | } | 430 | | } else { | 431 | 0 | for prev_ix_ref in | 432 | 0 | self.buckets_.slice().split_at(key as usize).1[..bucket_sweep as usize].iter() | 433 | | { | 434 | 0 | let mut prev_ix = *prev_ix_ref as usize; | 435 | 0 | let backward: usize = cur_ix.wrapping_sub(prev_ix); | 436 | 0 | prev_ix &= ring_buffer_mask as u32 as usize; | 437 | 0 | if compare_char != data[prev_ix.wrapping_add(best_len)] as i32 { | 438 | 0 | continue; | 439 | 0 | } | 440 | 0 | if backward == 0usize || backward > max_backward { | 441 | 0 | continue; | 442 | 0 | } | 443 | 0 | let unbroken_len = FindMatchLengthWithLimitMin4( | 444 | 0 | &data[prev_ix..], | 445 | 0 | &data[cur_ix_masked..], | 446 | 0 | max_length, | 447 | | ); | 448 | | | 449 | 0 | if unbroken_len != 0 { | 450 | 0 | let len = | 451 | 0 | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 452 | 0 | let score: u64 = BackwardReferenceScore(len, backward, opts); | 453 | 0 | if best_score < score { | 454 | 0 | best_score = score; | 455 | 0 | best_len = len; | 456 | 0 | out.len = best_len; | 457 | 0 | out.distance = backward; | 458 | 0 | out.score = score; | 459 | 0 | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; | 460 | 0 | is_match_found = true; | 461 | 0 | } | 462 | 0 | } | 463 | | } | 464 | | } | 465 | 12.3k | if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found { | 466 | 12.3k | is_match_found = SearchInStaticDictionary( | 467 | 12.3k | dictionary.unwrap(), | 468 | 12.3k | dictionary_hash, | 469 | 12.3k | self, | 470 | 12.3k | &data[cur_ix_masked..], | 471 | 12.3k | max_length, | 472 | 12.3k | max_backward.wrapping_add(gap), | 473 | 12.3k | max_distance, | 474 | 12.3k | out, | 475 | 12.3k | true, | 476 | 12.3k | ); | 477 | 12.3k | } | 478 | 12.3k | self.buckets_.slice_mut() | 479 | 12.3k | [(key as usize).wrapping_add((cur_ix >> 3).wrapping_rem(bucket_sweep as usize))] = | 480 | 12.3k | cur_ix as u32; | 481 | 12.3k | is_match_found | 482 | 2.75M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 357 | 1.23M | fn FindLongestMatch( | 358 | 1.23M | &mut self, | 359 | 1.23M | dictionary: Option<&BrotliDictionary>, | 360 | 1.23M | dictionary_hash: &[u16], | 361 | 1.23M | data: &[u8], | 362 | 1.23M | ring_buffer_mask: usize, | 363 | 1.23M | ring_buffer_break: Option<core::num::NonZeroUsize>, | 364 | 1.23M | distance_cache: &[i32], | 365 | 1.23M | cur_ix: usize, | 366 | 1.23M | max_length: usize, | 367 | 1.23M | max_backward: usize, | 368 | 1.23M | gap: usize, | 369 | 1.23M | max_distance: usize, | 370 | 1.23M | out: &mut HasherSearchResult, | 371 | 1.23M | ) -> bool { | 372 | 1.23M | let opts = self.Opts(); | 373 | 1.23M | let best_len_in: usize = out.len; | 374 | 1.23M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 375 | 1.23M | let key: u32 = self.HashBytes(&data[cur_ix_masked..]) as u32; | 376 | 1.23M | let mut compare_char: i32 = data[cur_ix_masked.wrapping_add(best_len_in)] as i32; | 377 | 1.23M | let mut best_score: u64 = out.score; | 378 | 1.23M | let mut best_len: usize = best_len_in; | 379 | 1.23M | let cached_backward: usize = distance_cache[0] as usize; | 380 | 1.23M | let mut prev_ix: usize = cur_ix.wrapping_sub(cached_backward); | 381 | 1.23M | let mut is_match_found = false; | 382 | 1.23M | out.len_x_code = 0usize; | 383 | 1.23M | if prev_ix < cur_ix { | 384 | 1.23M | prev_ix &= ring_buffer_mask as u32 as usize; | 385 | 1.23M | if compare_char == data[prev_ix.wrapping_add(best_len)] as i32 { | 386 | 193k | let unbroken_len: usize = FindMatchLengthWithLimitMin4( | 387 | 193k | &data[prev_ix..], | 388 | 193k | &data[cur_ix_masked..], | 389 | 193k | max_length, | 390 | | ); | 391 | 193k | if unbroken_len != 0 { | 392 | 55.2k | let len = | 393 | 55.2k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 394 | 55.2k | best_score = BackwardReferenceScoreUsingLastDistance(len, opts); | 395 | 55.2k | best_len = len; | 396 | 55.2k | out.len = len; | 397 | 55.2k | out.distance = cached_backward; | 398 | 55.2k | out.score = best_score; | 399 | 55.2k | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; | 400 | 55.2k | if self.buckets_.BUCKET_SWEEP() == 1i32 { | 401 | 0 | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; | 402 | 0 | return true; | 403 | 55.2k | } else { | 404 | 55.2k | is_match_found = true; | 405 | 55.2k | } | 406 | 138k | } | 407 | 1.03M | } | 408 | 1.84k | } | 409 | 1.23M | let bucket_sweep = self.buckets_.BUCKET_SWEEP(); | 410 | 1.23M | if bucket_sweep == 1i32 { | 411 | 0 | prev_ix = self.buckets_.slice()[key as usize] as usize; | 412 | 0 | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; | 413 | 0 | let backward: usize = cur_ix.wrapping_sub(prev_ix); | 414 | 0 | prev_ix &= ring_buffer_mask as u32 as usize; | 415 | 0 | if compare_char != data[prev_ix.wrapping_add(best_len_in)] as i32 { | 416 | 0 | return false; | 417 | 0 | } | 418 | 0 | if backward == 0usize || backward > max_backward { | 419 | 0 | return false; | 420 | 0 | } | 421 | 0 | let unbroken_len: usize = | 422 | 0 | FindMatchLengthWithLimitMin4(&data[prev_ix..], &data[cur_ix_masked..], max_length); | 423 | 0 | if unbroken_len != 0 { | 424 | 0 | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 425 | 0 | out.len = len; | 426 | 0 | out.distance = backward; | 427 | 0 | out.score = BackwardReferenceScore(len, backward, opts); | 428 | 0 | return true; | 429 | 0 | } | 430 | | } else { | 431 | 2.46M | for prev_ix_ref in | 432 | 1.23M | self.buckets_.slice().split_at(key as usize).1[..bucket_sweep as usize].iter() | 433 | | { | 434 | 2.46M | let mut prev_ix = *prev_ix_ref as usize; | 435 | 2.46M | let backward: usize = cur_ix.wrapping_sub(prev_ix); | 436 | 2.46M | prev_ix &= ring_buffer_mask as u32 as usize; | 437 | 2.46M | if compare_char != data[prev_ix.wrapping_add(best_len)] as i32 { | 438 | 1.37M | continue; | 439 | 1.09M | } | 440 | 1.09M | if backward == 0usize || backward > max_backward { | 441 | 837k | continue; | 442 | 254k | } | 443 | 254k | let unbroken_len = FindMatchLengthWithLimitMin4( | 444 | 254k | &data[prev_ix..], | 445 | 254k | &data[cur_ix_masked..], | 446 | 254k | max_length, | 447 | | ); | 448 | | | 449 | 254k | if unbroken_len != 0 { | 450 | 229k | let len = | 451 | 229k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 452 | 229k | let score: u64 = BackwardReferenceScore(len, backward, opts); | 453 | 229k | if best_score < score { | 454 | 213k | best_score = score; | 455 | 213k | best_len = len; | 456 | 213k | out.len = best_len; | 457 | 213k | out.distance = backward; | 458 | 213k | out.score = score; | 459 | 213k | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; | 460 | 213k | is_match_found = true; | 461 | 213k | } | 462 | 24.9k | } | 463 | | } | 464 | | } | 465 | 1.23M | if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found { | 466 | 0 | is_match_found = SearchInStaticDictionary( | 467 | 0 | dictionary.unwrap(), | 468 | 0 | dictionary_hash, | 469 | 0 | self, | 470 | 0 | &data[cur_ix_masked..], | 471 | 0 | max_length, | 472 | 0 | max_backward.wrapping_add(gap), | 473 | 0 | max_distance, | 474 | 0 | out, | 475 | 0 | true, | 476 | 0 | ); | 477 | 1.23M | } | 478 | 1.23M | self.buckets_.slice_mut() | 479 | 1.23M | [(key as usize).wrapping_add((cur_ix >> 3).wrapping_rem(bucket_sweep as usize))] = | 480 | 1.23M | cur_ix as u32; | 481 | 1.23M | is_match_found | 482 | 1.23M | } |
<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 357 | 1.50M | fn FindLongestMatch( | 358 | 1.50M | &mut self, | 359 | 1.50M | dictionary: Option<&BrotliDictionary>, | 360 | 1.50M | dictionary_hash: &[u16], | 361 | 1.50M | data: &[u8], | 362 | 1.50M | ring_buffer_mask: usize, | 363 | 1.50M | ring_buffer_break: Option<core::num::NonZeroUsize>, | 364 | 1.50M | distance_cache: &[i32], | 365 | 1.50M | cur_ix: usize, | 366 | 1.50M | max_length: usize, | 367 | 1.50M | max_backward: usize, | 368 | 1.50M | gap: usize, | 369 | 1.50M | max_distance: usize, | 370 | 1.50M | out: &mut HasherSearchResult, | 371 | 1.50M | ) -> bool { | 372 | 1.50M | let opts = self.Opts(); | 373 | 1.50M | let best_len_in: usize = out.len; | 374 | 1.50M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 375 | 1.50M | let key: u32 = self.HashBytes(&data[cur_ix_masked..]) as u32; | 376 | 1.50M | let mut compare_char: i32 = data[cur_ix_masked.wrapping_add(best_len_in)] as i32; | 377 | 1.50M | let mut best_score: u64 = out.score; | 378 | 1.50M | let mut best_len: usize = best_len_in; | 379 | 1.50M | let cached_backward: usize = distance_cache[0] as usize; | 380 | 1.50M | let mut prev_ix: usize = cur_ix.wrapping_sub(cached_backward); | 381 | 1.50M | let mut is_match_found = false; | 382 | 1.50M | out.len_x_code = 0usize; | 383 | 1.50M | if prev_ix < cur_ix { | 384 | 1.50M | prev_ix &= ring_buffer_mask as u32 as usize; | 385 | 1.50M | if compare_char == data[prev_ix.wrapping_add(best_len)] as i32 { | 386 | 218k | let unbroken_len: usize = FindMatchLengthWithLimitMin4( | 387 | 218k | &data[prev_ix..], | 388 | 218k | &data[cur_ix_masked..], | 389 | 218k | max_length, | 390 | | ); | 391 | 218k | if unbroken_len != 0 { | 392 | 82.5k | let len = | 393 | 82.5k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 394 | 82.5k | best_score = BackwardReferenceScoreUsingLastDistance(len, opts); | 395 | 82.5k | best_len = len; | 396 | 82.5k | out.len = len; | 397 | 82.5k | out.distance = cached_backward; | 398 | 82.5k | out.score = best_score; | 399 | 82.5k | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; | 400 | 82.5k | if self.buckets_.BUCKET_SWEEP() == 1i32 { | 401 | 0 | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; | 402 | 0 | return true; | 403 | 82.5k | } else { | 404 | 82.5k | is_match_found = true; | 405 | 82.5k | } | 406 | 135k | } | 407 | 1.28M | } | 408 | 1.97k | } | 409 | 1.50M | let bucket_sweep = self.buckets_.BUCKET_SWEEP(); | 410 | 1.50M | if bucket_sweep == 1i32 { | 411 | 0 | prev_ix = self.buckets_.slice()[key as usize] as usize; | 412 | 0 | self.buckets_.slice_mut()[key as usize] = cur_ix as u32; | 413 | 0 | let backward: usize = cur_ix.wrapping_sub(prev_ix); | 414 | 0 | prev_ix &= ring_buffer_mask as u32 as usize; | 415 | 0 | if compare_char != data[prev_ix.wrapping_add(best_len_in)] as i32 { | 416 | 0 | return false; | 417 | 0 | } | 418 | 0 | if backward == 0usize || backward > max_backward { | 419 | 0 | return false; | 420 | 0 | } | 421 | 0 | let unbroken_len: usize = | 422 | 0 | FindMatchLengthWithLimitMin4(&data[prev_ix..], &data[cur_ix_masked..], max_length); | 423 | 0 | if unbroken_len != 0 { | 424 | 0 | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 425 | 0 | out.len = len; | 426 | 0 | out.distance = backward; | 427 | 0 | out.score = BackwardReferenceScore(len, backward, opts); | 428 | 0 | return true; | 429 | 0 | } | 430 | | } else { | 431 | 6.01M | for prev_ix_ref in | 432 | 1.50M | self.buckets_.slice().split_at(key as usize).1[..bucket_sweep as usize].iter() | 433 | | { | 434 | 6.01M | let mut prev_ix = *prev_ix_ref as usize; | 435 | 6.01M | let backward: usize = cur_ix.wrapping_sub(prev_ix); | 436 | 6.01M | prev_ix &= ring_buffer_mask as u32 as usize; | 437 | 6.01M | if compare_char != data[prev_ix.wrapping_add(best_len)] as i32 { | 438 | 3.43M | continue; | 439 | 2.57M | } | 440 | 2.57M | if backward == 0usize || backward > max_backward { | 441 | 2.26M | continue; | 442 | 305k | } | 443 | 305k | let unbroken_len = FindMatchLengthWithLimitMin4( | 444 | 305k | &data[prev_ix..], | 445 | 305k | &data[cur_ix_masked..], | 446 | 305k | max_length, | 447 | | ); | 448 | | | 449 | 305k | if unbroken_len != 0 { | 450 | 270k | let len = | 451 | 270k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 452 | 270k | let score: u64 = BackwardReferenceScore(len, backward, opts); | 453 | 270k | if best_score < score { | 454 | 229k | best_score = score; | 455 | 229k | best_len = len; | 456 | 229k | out.len = best_len; | 457 | 229k | out.distance = backward; | 458 | 229k | out.score = score; | 459 | 229k | compare_char = data[cur_ix_masked.wrapping_add(best_len)] as i32; | 460 | 229k | is_match_found = true; | 461 | 229k | } | 462 | 35.4k | } | 463 | | } | 464 | | } | 465 | 1.50M | if dictionary.is_some() && self.buckets_.USE_DICTIONARY() != 0 && !is_match_found { | 466 | 1.24M | is_match_found = SearchInStaticDictionary( | 467 | 1.24M | dictionary.unwrap(), | 468 | 1.24M | dictionary_hash, | 469 | 1.24M | self, | 470 | 1.24M | &data[cur_ix_masked..], | 471 | 1.24M | max_length, | 472 | 1.24M | max_backward.wrapping_add(gap), | 473 | 1.24M | max_distance, | 474 | 1.24M | out, | 475 | 1.24M | true, | 476 | 1.24M | ); | 477 | 1.24M | } | 478 | 1.50M | self.buckets_.slice_mut() | 479 | 1.50M | [(key as usize).wrapping_add((cur_ix >> 3).wrapping_rem(bucket_sweep as usize))] = | 480 | 1.50M | cur_ix as u32; | 481 | 1.50M | is_match_found | 482 | 1.50M | } |
Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Unexecuted instantiation: <brotli::enc::backward_references::BasicHasher<_> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch |
483 | | } |
484 | | impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H2Sub<AllocU32> { |
485 | 17.5M | fn HashBytes(&self, data: &[u8]) -> u32 { |
486 | 17.5M | let h: u64 = |
487 | 17.5M | (BROTLI_UNALIGNED_LOAD64(data) << (64i32 - 8i32 * 5i32)).wrapping_mul(kHashMul64); |
488 | 17.5M | (h >> (64i32 - 16i32)) as u32 |
489 | 17.5M | } <brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::HashBytes Line | Count | Source | 485 | 17.5M | fn HashBytes(&self, data: &[u8]) -> u32 { | 486 | 17.5M | let h: u64 = | 487 | 17.5M | (BROTLI_UNALIGNED_LOAD64(data) << (64i32 - 8i32 * 5i32)).wrapping_mul(kHashMul64); | 488 | 17.5M | (h >> (64i32 - 16i32)) as u32 | 489 | 17.5M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H2Sub<_> as brotli::enc::backward_references::BasicHashComputer>::HashBytes |
490 | 0 | fn BUCKET_BITS(&self) -> i32 { |
491 | 0 | 16 |
492 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS Unexecuted instantiation: <brotli::enc::backward_references::H2Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS |
493 | 8.61M | fn BUCKET_SWEEP(&self) -> i32 { |
494 | 8.61M | 1 |
495 | 8.61M | } <brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP Line | Count | Source | 493 | 8.61M | fn BUCKET_SWEEP(&self) -> i32 { | 494 | 8.61M | 1 | 495 | 8.61M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H2Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP |
496 | 12.3k | fn USE_DICTIONARY(&self) -> i32 { |
497 | 12.3k | 1 |
498 | 12.3k | } <brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY Line | Count | Source | 496 | 12.3k | fn USE_DICTIONARY(&self) -> i32 { | 497 | 12.3k | 1 | 498 | 12.3k | } |
Unexecuted instantiation: <brotli::enc::backward_references::H2Sub<_> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY |
499 | | } |
500 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H2Sub<AllocU32> { |
501 | 17.5M | fn slice_mut(&mut self) -> &mut [u32] { |
502 | 17.5M | return self.buckets_.slice_mut(); |
503 | 17.5M | } <brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut Line | Count | Source | 501 | 17.5M | fn slice_mut(&mut self) -> &mut [u32] { | 502 | 17.5M | return self.buckets_.slice_mut(); | 503 | 17.5M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H2Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut |
504 | | } |
505 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapper<u32> for H2Sub<AllocU32> { |
506 | 2.64M | fn slice(&self) -> &[u32] { |
507 | 2.64M | return self.buckets_.slice(); |
508 | 2.64M | } <brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice Line | Count | Source | 506 | 2.64M | fn slice(&self) -> &[u32] { | 507 | 2.64M | return self.buckets_.slice(); | 508 | 2.64M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H2Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice |
509 | | } |
510 | | pub struct H3Sub<AllocU32: alloc::Allocator<u32>> { |
511 | | pub buckets_: AllocU32::AllocatedMemory, // 65538 |
512 | | } |
513 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H3Sub<AllocU32> { |
514 | 9.04M | fn slice_mut(&mut self) -> &mut [u32] { |
515 | 9.04M | return self.buckets_.slice_mut(); |
516 | 9.04M | } <brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut Line | Count | Source | 514 | 9.04M | fn slice_mut(&mut self) -> &mut [u32] { | 515 | 9.04M | return self.buckets_.slice_mut(); | 516 | 9.04M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H3Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut |
517 | | } |
518 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapper<u32> for H3Sub<AllocU32> { |
519 | 1.23M | fn slice(&self) -> &[u32] { |
520 | 1.23M | return self.buckets_.slice(); |
521 | 1.23M | } <brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice Line | Count | Source | 519 | 1.23M | fn slice(&self) -> &[u32] { | 520 | 1.23M | return self.buckets_.slice(); | 521 | 1.23M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H3Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice |
522 | | } |
523 | | impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H3Sub<AllocU32> { |
524 | 0 | fn BUCKET_BITS(&self) -> i32 { |
525 | 0 | 16 |
526 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS Unexecuted instantiation: <brotli::enc::backward_references::H3Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS |
527 | 4.42M | fn BUCKET_SWEEP(&self) -> i32 { |
528 | 4.42M | 2 |
529 | 4.42M | } <brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP Line | Count | Source | 527 | 4.42M | fn BUCKET_SWEEP(&self) -> i32 { | 528 | 4.42M | 2 | 529 | 4.42M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H3Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP |
530 | 1.23M | fn USE_DICTIONARY(&self) -> i32 { |
531 | 1.23M | 0 |
532 | 1.23M | } <brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY Line | Count | Source | 530 | 1.23M | fn USE_DICTIONARY(&self) -> i32 { | 531 | 1.23M | 0 | 532 | 1.23M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H3Sub<_> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY |
533 | 9.04M | fn HashBytes(&self, data: &[u8]) -> u32 { |
534 | 9.04M | let h: u64 = |
535 | 9.04M | (BROTLI_UNALIGNED_LOAD64(data) << (64i32 - 8i32 * 5i32)).wrapping_mul(kHashMul64); |
536 | 9.04M | (h >> (64i32 - 16i32)) as u32 |
537 | 9.04M | } <brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::HashBytes Line | Count | Source | 533 | 9.04M | fn HashBytes(&self, data: &[u8]) -> u32 { | 534 | 9.04M | let h: u64 = | 535 | 9.04M | (BROTLI_UNALIGNED_LOAD64(data) << (64i32 - 8i32 * 5i32)).wrapping_mul(kHashMul64); | 536 | 9.04M | (h >> (64i32 - 16i32)) as u32 | 537 | 9.04M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H3Sub<_> as brotli::enc::backward_references::BasicHashComputer>::HashBytes |
538 | | } |
539 | | pub struct H4Sub<AllocU32: alloc::Allocator<u32>> { |
540 | | pub buckets_: AllocU32::AllocatedMemory, // 131076 |
541 | | } |
542 | | impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H4Sub<AllocU32> { |
543 | 0 | fn BUCKET_BITS(&self) -> i32 { |
544 | 0 | 17 |
545 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS Unexecuted instantiation: <brotli::enc::backward_references::H4Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS |
546 | 4.56M | fn BUCKET_SWEEP(&self) -> i32 { |
547 | 4.56M | 4 |
548 | 4.56M | } <brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP Line | Count | Source | 546 | 4.56M | fn BUCKET_SWEEP(&self) -> i32 { | 547 | 4.56M | 4 | 548 | 4.56M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H4Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP |
549 | 1.50M | fn USE_DICTIONARY(&self) -> i32 { |
550 | 1.50M | 1 |
551 | 1.50M | } <brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY Line | Count | Source | 549 | 1.50M | fn USE_DICTIONARY(&self) -> i32 { | 550 | 1.50M | 1 | 551 | 1.50M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H4Sub<_> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY |
552 | 8.62M | fn HashBytes(&self, data: &[u8]) -> u32 { |
553 | 8.62M | let h: u64 = |
554 | 8.62M | (BROTLI_UNALIGNED_LOAD64(data) << (64i32 - 8i32 * 5i32)).wrapping_mul(kHashMul64); |
555 | 8.62M | (h >> (64i32 - 17i32)) as u32 |
556 | 8.62M | } <brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::HashBytes Line | Count | Source | 552 | 8.62M | fn HashBytes(&self, data: &[u8]) -> u32 { | 553 | 8.62M | let h: u64 = | 554 | 8.62M | (BROTLI_UNALIGNED_LOAD64(data) << (64i32 - 8i32 * 5i32)).wrapping_mul(kHashMul64); | 555 | 8.62M | (h >> (64i32 - 17i32)) as u32 | 556 | 8.62M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H4Sub<_> as brotli::enc::backward_references::BasicHashComputer>::HashBytes |
557 | | } |
558 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H4Sub<AllocU32> { |
559 | 8.62M | fn slice_mut(&mut self) -> &mut [u32] { |
560 | 8.62M | return self.buckets_.slice_mut(); |
561 | 8.62M | } <brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut Line | Count | Source | 559 | 8.62M | fn slice_mut(&mut self) -> &mut [u32] { | 560 | 8.62M | return self.buckets_.slice_mut(); | 561 | 8.62M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H4Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut |
562 | | } |
563 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapper<u32> for H4Sub<AllocU32> { |
564 | 1.50M | fn slice(&self) -> &[u32] { |
565 | 1.50M | return self.buckets_.slice(); |
566 | 1.50M | } <brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice Line | Count | Source | 564 | 1.50M | fn slice(&self) -> &[u32] { | 565 | 1.50M | return self.buckets_.slice(); | 566 | 1.50M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H4Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice |
567 | | } |
568 | | pub struct H54Sub<AllocU32: alloc::Allocator<u32>> { |
569 | | pub buckets_: AllocU32::AllocatedMemory, |
570 | | } |
571 | | impl<AllocU32: alloc::Allocator<u32>> BasicHashComputer for H54Sub<AllocU32> { |
572 | 0 | fn BUCKET_BITS(&self) -> i32 { |
573 | 0 | 20 |
574 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_BITS |
575 | 0 | fn BUCKET_SWEEP(&self) -> i32 { |
576 | 0 | 4 |
577 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<_> as brotli::enc::backward_references::BasicHashComputer>::BUCKET_SWEEP |
578 | 0 | fn USE_DICTIONARY(&self) -> i32 { |
579 | 0 | 0 |
580 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<_> as brotli::enc::backward_references::BasicHashComputer>::USE_DICTIONARY |
581 | 0 | fn HashBytes(&self, data: &[u8]) -> u32 { |
582 | 0 | let h: u64 = |
583 | 0 | (BROTLI_UNALIGNED_LOAD64(data) << (64i32 - 8i32 * 7i32)).wrapping_mul(kHashMul64); |
584 | 0 | (h >> (64i32 - 20i32)) as u32 |
585 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::BasicHashComputer>::HashBytes Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<_> as brotli::enc::backward_references::BasicHashComputer>::HashBytes |
586 | | } |
587 | | |
588 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapperMut<u32> for H54Sub<AllocU32> { |
589 | 0 | fn slice_mut(&mut self) -> &mut [u32] { |
590 | 0 | return self.buckets_.slice_mut(); |
591 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut |
592 | | } |
593 | | impl<AllocU32: alloc::Allocator<u32>> SliceWrapper<u32> for H54Sub<AllocU32> { |
594 | 0 | fn slice(&self) -> &[u32] { |
595 | 0 | return self.buckets_.slice(); |
596 | 0 | } Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice Unexecuted instantiation: <brotli::enc::backward_references::H54Sub<_> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice |
597 | | } |
598 | | pub const H9_BUCKET_BITS: usize = 15; |
599 | | pub const H9_BLOCK_BITS: usize = 8; |
600 | | pub const H9_NUM_LAST_DISTANCES_TO_CHECK: usize = 16; |
601 | | pub const H9_BLOCK_SIZE: usize = 1 << H9_BLOCK_BITS; |
602 | | const H9_BLOCK_MASK: usize = (1 << H9_BLOCK_BITS) - 1; |
603 | | |
604 | | impl H9Opts { |
605 | 4.94k | pub fn new(params: &BrotliHasherParams) -> H9Opts { |
606 | | H9Opts { |
607 | 4.94k | literal_byte_score: if params.literal_byte_score != 0 { |
608 | 0 | params.literal_byte_score as u32 |
609 | | } else { |
610 | 4.94k | 540 |
611 | | }, |
612 | | } |
613 | 4.94k | } |
614 | | } |
615 | | |
616 | | pub struct H9<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> { |
617 | | pub num_: <Alloc as Allocator<u16>>::AllocatedMemory, //[u16;1 << H9_BUCKET_BITS], |
618 | | pub buckets_: <Alloc as Allocator<u32>>::AllocatedMemory, //[u32; H9_BLOCK_SIZE << H9_BUCKET_BITS], |
619 | | pub dict_search_stats_: Struct1, |
620 | | pub h9_opts: H9Opts, |
621 | | } |
622 | | |
623 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> PartialEq<H9<Alloc>> for H9<Alloc> { |
624 | 0 | fn eq(&self, other: &H9<Alloc>) -> bool { |
625 | 0 | self.dict_search_stats_ == other.dict_search_stats_ |
626 | 0 | && self.num_.slice() == other.num_.slice() |
627 | 0 | && self.buckets_.slice() == other.buckets_.slice() |
628 | 0 | && self.h9_opts == other.h9_opts |
629 | 0 | } |
630 | | } |
631 | | |
632 | 724k | fn adv_prepare_distance_cache(distance_cache: &mut [i32], num_distances: i32) { |
633 | 724k | if num_distances > 4i32 { |
634 | 628k | let last_distance: i32 = distance_cache[0]; |
635 | 628k | distance_cache[4] = last_distance - 1i32; |
636 | 628k | distance_cache[5] = last_distance + 1i32; |
637 | 628k | distance_cache[6] = last_distance - 2i32; |
638 | 628k | distance_cache[7] = last_distance + 2i32; |
639 | 628k | distance_cache[8] = last_distance - 3i32; |
640 | 628k | distance_cache[9] = last_distance + 3i32; |
641 | 628k | if num_distances > 10i32 { |
642 | 548k | let next_last_distance: i32 = distance_cache[1]; |
643 | 548k | distance_cache[10] = next_last_distance - 1i32; |
644 | 548k | distance_cache[11] = next_last_distance + 1i32; |
645 | 548k | distance_cache[12] = next_last_distance - 2i32; |
646 | 548k | distance_cache[13] = next_last_distance + 2i32; |
647 | 548k | distance_cache[14] = next_last_distance - 3i32; |
648 | 548k | distance_cache[15] = next_last_distance + 3i32; |
649 | 548k | } |
650 | 95.7k | } |
651 | 724k | } |
652 | | |
653 | | pub const kDistanceCacheIndex: [u8; 16] = [0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]; |
654 | | |
655 | | pub const kDistanceCacheOffset: [i8; 16] = [0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3]; |
656 | | |
657 | | //const BROTLI_LITERAL_BYTE_SCORE: u64 = 540; |
658 | | const BROTLI_DISTANCE_BIT_PENALTY: u32 = 120; |
659 | | |
660 | | // Score must be positive after applying maximal penalty. |
661 | | const BROTLI_SCORE_BASE: u32 = (BROTLI_DISTANCE_BIT_PENALTY * 8 * 8/* sizeof usize*/); |
662 | | const kDistanceShortCodeCost: [u32; 16] = [ |
663 | | /* Repeat last */ |
664 | | BROTLI_SCORE_BASE + 60, |
665 | | /* 2nd, 3rd, 4th last */ |
666 | | BROTLI_SCORE_BASE - 95, |
667 | | BROTLI_SCORE_BASE - 117, |
668 | | BROTLI_SCORE_BASE - 127, |
669 | | /* Last with offset */ |
670 | | BROTLI_SCORE_BASE - 93, |
671 | | BROTLI_SCORE_BASE - 93, |
672 | | BROTLI_SCORE_BASE - 96, |
673 | | BROTLI_SCORE_BASE - 96, |
674 | | BROTLI_SCORE_BASE - 99, |
675 | | BROTLI_SCORE_BASE - 99, |
676 | | /* 2nd last with offset */ |
677 | | BROTLI_SCORE_BASE - 105, |
678 | | BROTLI_SCORE_BASE - 105, |
679 | | BROTLI_SCORE_BASE - 115, |
680 | | BROTLI_SCORE_BASE - 115, |
681 | | BROTLI_SCORE_BASE - 125, |
682 | | BROTLI_SCORE_BASE - 125, |
683 | | ]; |
684 | | |
685 | 1.71M | fn BackwardReferenceScoreH9( |
686 | 1.71M | copy_length: usize, |
687 | 1.71M | backward_reference_offset: usize, |
688 | 1.71M | h9_opts: H9Opts, |
689 | 1.71M | ) -> u64 { |
690 | 1.71M | (u64::from(BROTLI_SCORE_BASE) |
691 | 1.71M | .wrapping_add((h9_opts.literal_byte_score as u64).wrapping_mul(copy_length as u64)) |
692 | 1.71M | .wrapping_sub( |
693 | 1.71M | (BROTLI_DISTANCE_BIT_PENALTY as u64) |
694 | 1.71M | .wrapping_mul(Log2FloorNonZero(backward_reference_offset as u64) as u64), |
695 | 1.71M | )) |
696 | 1.71M | >> 2 |
697 | 1.71M | } |
698 | | |
699 | 420k | fn BackwardReferenceScoreUsingLastDistanceH9( |
700 | 420k | copy_length: usize, |
701 | 420k | distance_short_code: usize, |
702 | 420k | h9_opts: H9Opts, |
703 | 420k | ) -> u64 { |
704 | 420k | ((h9_opts.literal_byte_score as u64) |
705 | 420k | .wrapping_mul(copy_length as u64) |
706 | 420k | .wrapping_add(u64::from(kDistanceShortCodeCost[distance_short_code]))) |
707 | 420k | >> 2 |
708 | 420k | } |
709 | | |
710 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for H9<Alloc> { |
711 | | #[inline(always)] |
712 | 1.13M | fn Opts(&self) -> H9Opts { |
713 | 1.13M | self.h9_opts |
714 | 1.13M | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 712 | 1.13M | fn Opts(&self) -> H9Opts { | 713 | 1.13M | self.h9_opts | 714 | 1.13M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::Opts |
715 | | #[inline(always)] |
716 | 1.13M | fn GetHasherCommon(&mut self) -> &mut Struct1 { |
717 | 1.13M | &mut self.dict_search_stats_ |
718 | 1.13M | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 716 | 1.13M | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 717 | 1.13M | &mut self.dict_search_stats_ | 718 | 1.13M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon |
719 | | #[inline(always)] |
720 | 7.91M | fn HashBytes(&self, data: &[u8]) -> usize { |
721 | 7.91M | let h: u32 = BROTLI_UNALIGNED_LOAD32(data).wrapping_mul(kHashMul32); |
722 | 7.91M | let thirty_two: usize = 32; |
723 | 7.91M | (h >> (thirty_two.wrapping_sub(H9_BUCKET_BITS))) as usize |
724 | 7.91M | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 720 | 7.91M | fn HashBytes(&self, data: &[u8]) -> usize { | 721 | 7.91M | let h: u32 = BROTLI_UNALIGNED_LOAD32(data).wrapping_mul(kHashMul32); | 722 | 7.91M | let thirty_two: usize = 32; | 723 | 7.91M | (h >> (thirty_two.wrapping_sub(H9_BUCKET_BITS))) as usize | 724 | 7.91M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::HashBytes |
725 | | #[inline(always)] |
726 | 1.38M | fn HashTypeLength(&self) -> usize { |
727 | 1.38M | 4 |
728 | 1.38M | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 726 | 1.38M | fn HashTypeLength(&self) -> usize { | 727 | 1.38M | 4 | 728 | 1.38M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::HashTypeLength |
729 | | #[inline(always)] |
730 | 59.1k | fn StoreLookahead(&self) -> usize { |
731 | 59.1k | 4 |
732 | 59.1k | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 730 | 59.1k | fn StoreLookahead(&self) -> usize { | 731 | 59.1k | 4 | 732 | 59.1k | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::StoreLookahead |
733 | 202k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { |
734 | 202k | let num_distances = H9_NUM_LAST_DISTANCES_TO_CHECK as i32; |
735 | 202k | adv_prepare_distance_cache(distance_cache, num_distances); |
736 | 202k | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 733 | 202k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { | 734 | 202k | let num_distances = H9_NUM_LAST_DISTANCES_TO_CHECK as i32; | 735 | 202k | adv_prepare_distance_cache(distance_cache, num_distances); | 736 | 202k | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache |
737 | 1.69M | fn FindLongestMatch( |
738 | 1.69M | &mut self, |
739 | 1.69M | dictionary: Option<&BrotliDictionary>, |
740 | 1.69M | dictionary_hash: &[u16], |
741 | 1.69M | data: &[u8], |
742 | 1.69M | ring_buffer_mask: usize, |
743 | 1.69M | ring_buffer_break: Option<core::num::NonZeroUsize>, |
744 | 1.69M | distance_cache: &[i32], |
745 | 1.69M | cur_ix: usize, |
746 | 1.69M | max_length: usize, |
747 | 1.69M | max_backward: usize, |
748 | 1.69M | gap: usize, |
749 | 1.69M | max_distance: usize, |
750 | 1.69M | out: &mut HasherSearchResult, |
751 | 1.69M | ) -> bool { |
752 | 1.69M | let best_len_in: usize = out.len; |
753 | 1.69M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; |
754 | 1.69M | let mut best_score: u64 = out.score; |
755 | 1.69M | let mut best_len: usize = best_len_in; |
756 | 1.69M | let mut is_match_found = false; |
757 | 1.69M | out.len_x_code = 0usize; |
758 | 28.8M | for i in 0..H9_NUM_LAST_DISTANCES_TO_CHECK { |
759 | 27.1M | let idx = kDistanceCacheIndex[i] as usize; |
760 | 27.1M | let backward = |
761 | 27.1M | (distance_cache[idx] as usize).wrapping_add(kDistanceCacheOffset[i] as usize); |
762 | 27.1M | let mut prev_ix = cur_ix.wrapping_sub(backward); |
763 | 27.1M | if prev_ix >= cur_ix { |
764 | 1.50M | continue; |
765 | 25.6M | } |
766 | 25.6M | if backward > max_backward { |
767 | 7.63k | continue; |
768 | 25.6M | } |
769 | 25.6M | prev_ix &= ring_buffer_mask; |
770 | 25.6M | if cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask |
771 | 25.6M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask |
772 | 25.6M | || data[cur_ix_masked.wrapping_add(best_len)] |
773 | 25.6M | != data[prev_ix.wrapping_add(best_len)] |
774 | | { |
775 | 23.4M | continue; |
776 | 2.15M | } |
777 | | { |
778 | 2.15M | let unbroken_len: usize = |
779 | 2.15M | FindMatchLengthWithLimit(&data[prev_ix..], &data[cur_ix_masked..], max_length); |
780 | 2.15M | if unbroken_len >= 3 || (unbroken_len == 2 && i < 2) { |
781 | 420k | let len = |
782 | 420k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); |
783 | 420k | let score = BackwardReferenceScoreUsingLastDistanceH9(len, i, self.h9_opts); |
784 | 420k | if best_score < score { |
785 | 391k | best_score = score; |
786 | 391k | best_len = len; |
787 | 391k | out.len = best_len; |
788 | 391k | out.distance = backward; |
789 | 391k | out.score = best_score; |
790 | 391k | is_match_found = true; |
791 | 391k | } |
792 | 1.73M | } |
793 | | } |
794 | | } |
795 | 1.69M | if max_length >= 4 && cur_ix_masked.wrapping_add(best_len) <= ring_buffer_mask { |
796 | 1.69M | let key = self.HashBytes(data.split_at(cur_ix_masked).1); |
797 | 1.69M | let bucket = &mut self |
798 | 1.69M | .buckets_ |
799 | 1.69M | .slice_mut() |
800 | 1.69M | .split_at_mut(key << H9_BLOCK_BITS) |
801 | 1.69M | .1 |
802 | 1.69M | .split_at_mut(H9_BLOCK_SIZE) |
803 | 1.69M | .0; |
804 | 1.69M | assert!(bucket.len() > H9_BLOCK_MASK); |
805 | 1.69M | assert_eq!(bucket.len(), H9_BLOCK_MASK + 1); |
806 | 1.69M | let self_num_key = &mut self.num_.slice_mut()[key]; |
807 | 1.69M | let down = if *self_num_key > H9_BLOCK_SIZE as u16 { |
808 | 190k | (*self_num_key as usize) - H9_BLOCK_SIZE |
809 | | } else { |
810 | 1.50M | 0usize |
811 | | }; |
812 | 1.69M | let mut i: usize = *self_num_key as usize; |
813 | 1.69M | let mut prev_best_val = data[cur_ix_masked.wrapping_add(best_len)]; |
814 | 15.0M | while i > down { |
815 | 14.3M | i -= 1; |
816 | 14.3M | let mut prev_ix = bucket[i & H9_BLOCK_MASK] as usize; |
817 | 14.3M | let backward = cur_ix.wrapping_sub(prev_ix); |
818 | 14.3M | if (backward > max_backward) { |
819 | 988k | break; |
820 | 13.3M | } |
821 | 13.3M | prev_ix &= ring_buffer_mask; |
822 | 13.3M | if (prev_ix.wrapping_add(best_len) > ring_buffer_mask |
823 | 13.3M | || prev_best_val != data[prev_ix.wrapping_add(best_len)]) |
824 | | { |
825 | 11.5M | continue; |
826 | 1.72M | } |
827 | | { |
828 | 1.72M | let unbroken_len = FindMatchLengthWithLimit( |
829 | 1.72M | data.split_at(prev_ix).1, |
830 | 1.72M | data.split_at(cur_ix_masked).1, |
831 | 1.72M | max_length, |
832 | | ); |
833 | 1.72M | if (unbroken_len >= 4) { |
834 | 1.71M | let len = fix_unbroken_len( |
835 | 1.71M | unbroken_len, |
836 | 1.71M | prev_ix, |
837 | 1.71M | cur_ix_masked, |
838 | 1.71M | ring_buffer_break, |
839 | | ); |
840 | | /* Comparing for >= 3 does not change the semantics, but just saves |
841 | | for a few unnecessary binary logarithms in backward reference |
842 | | score, since we are not interested in such short matches. */ |
843 | 1.71M | let score = BackwardReferenceScoreH9(len, backward, self.h9_opts); |
844 | 1.71M | if (best_score < score) { |
845 | 687k | best_score = score; |
846 | 687k | best_len = len; |
847 | 687k | out.len = best_len; |
848 | 687k | out.distance = backward; |
849 | 687k | out.score = best_score; |
850 | 687k | is_match_found = true; |
851 | 687k | if cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask { |
852 | 25 | break; |
853 | 687k | } |
854 | 687k | prev_best_val = data[cur_ix_masked.wrapping_add(best_len)]; |
855 | 1.02M | } |
856 | 11.4k | } |
857 | | } |
858 | | } |
859 | 1.69M | bucket[*self_num_key as usize & H9_BLOCK_MASK] = cur_ix as u32; |
860 | 1.69M | *self_num_key = self_num_key.wrapping_add(1); |
861 | 29 | } |
862 | 1.69M | if !is_match_found && dictionary.is_some() { |
863 | 1.13M | let (_, cur_data) = data.split_at(cur_ix_masked); |
864 | 1.13M | is_match_found = SearchInStaticDictionary( |
865 | 1.13M | dictionary.unwrap(), |
866 | 1.13M | dictionary_hash, |
867 | 1.13M | self, |
868 | 1.13M | cur_data, |
869 | 1.13M | max_length, |
870 | 1.13M | max_backward.wrapping_add(gap), |
871 | 1.13M | max_distance, |
872 | 1.13M | out, |
873 | 1.13M | false, |
874 | 1.13M | ); |
875 | 1.13M | } |
876 | 1.69M | is_match_found |
877 | 1.69M | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 737 | 1.69M | fn FindLongestMatch( | 738 | 1.69M | &mut self, | 739 | 1.69M | dictionary: Option<&BrotliDictionary>, | 740 | 1.69M | dictionary_hash: &[u16], | 741 | 1.69M | data: &[u8], | 742 | 1.69M | ring_buffer_mask: usize, | 743 | 1.69M | ring_buffer_break: Option<core::num::NonZeroUsize>, | 744 | 1.69M | distance_cache: &[i32], | 745 | 1.69M | cur_ix: usize, | 746 | 1.69M | max_length: usize, | 747 | 1.69M | max_backward: usize, | 748 | 1.69M | gap: usize, | 749 | 1.69M | max_distance: usize, | 750 | 1.69M | out: &mut HasherSearchResult, | 751 | 1.69M | ) -> bool { | 752 | 1.69M | let best_len_in: usize = out.len; | 753 | 1.69M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 754 | 1.69M | let mut best_score: u64 = out.score; | 755 | 1.69M | let mut best_len: usize = best_len_in; | 756 | 1.69M | let mut is_match_found = false; | 757 | 1.69M | out.len_x_code = 0usize; | 758 | 28.8M | for i in 0..H9_NUM_LAST_DISTANCES_TO_CHECK { | 759 | 27.1M | let idx = kDistanceCacheIndex[i] as usize; | 760 | 27.1M | let backward = | 761 | 27.1M | (distance_cache[idx] as usize).wrapping_add(kDistanceCacheOffset[i] as usize); | 762 | 27.1M | let mut prev_ix = cur_ix.wrapping_sub(backward); | 763 | 27.1M | if prev_ix >= cur_ix { | 764 | 1.50M | continue; | 765 | 25.6M | } | 766 | 25.6M | if backward > max_backward { | 767 | 7.63k | continue; | 768 | 25.6M | } | 769 | 25.6M | prev_ix &= ring_buffer_mask; | 770 | 25.6M | if cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 771 | 25.6M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 772 | 25.6M | || data[cur_ix_masked.wrapping_add(best_len)] | 773 | 25.6M | != data[prev_ix.wrapping_add(best_len)] | 774 | | { | 775 | 23.4M | continue; | 776 | 2.15M | } | 777 | | { | 778 | 2.15M | let unbroken_len: usize = | 779 | 2.15M | FindMatchLengthWithLimit(&data[prev_ix..], &data[cur_ix_masked..], max_length); | 780 | 2.15M | if unbroken_len >= 3 || (unbroken_len == 2 && i < 2) { | 781 | 420k | let len = | 782 | 420k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 783 | 420k | let score = BackwardReferenceScoreUsingLastDistanceH9(len, i, self.h9_opts); | 784 | 420k | if best_score < score { | 785 | 391k | best_score = score; | 786 | 391k | best_len = len; | 787 | 391k | out.len = best_len; | 788 | 391k | out.distance = backward; | 789 | 391k | out.score = best_score; | 790 | 391k | is_match_found = true; | 791 | 391k | } | 792 | 1.73M | } | 793 | | } | 794 | | } | 795 | 1.69M | if max_length >= 4 && cur_ix_masked.wrapping_add(best_len) <= ring_buffer_mask { | 796 | 1.69M | let key = self.HashBytes(data.split_at(cur_ix_masked).1); | 797 | 1.69M | let bucket = &mut self | 798 | 1.69M | .buckets_ | 799 | 1.69M | .slice_mut() | 800 | 1.69M | .split_at_mut(key << H9_BLOCK_BITS) | 801 | 1.69M | .1 | 802 | 1.69M | .split_at_mut(H9_BLOCK_SIZE) | 803 | 1.69M | .0; | 804 | 1.69M | assert!(bucket.len() > H9_BLOCK_MASK); | 805 | 1.69M | assert_eq!(bucket.len(), H9_BLOCK_MASK + 1); | 806 | 1.69M | let self_num_key = &mut self.num_.slice_mut()[key]; | 807 | 1.69M | let down = if *self_num_key > H9_BLOCK_SIZE as u16 { | 808 | 190k | (*self_num_key as usize) - H9_BLOCK_SIZE | 809 | | } else { | 810 | 1.50M | 0usize | 811 | | }; | 812 | 1.69M | let mut i: usize = *self_num_key as usize; | 813 | 1.69M | let mut prev_best_val = data[cur_ix_masked.wrapping_add(best_len)]; | 814 | 15.0M | while i > down { | 815 | 14.3M | i -= 1; | 816 | 14.3M | let mut prev_ix = bucket[i & H9_BLOCK_MASK] as usize; | 817 | 14.3M | let backward = cur_ix.wrapping_sub(prev_ix); | 818 | 14.3M | if (backward > max_backward) { | 819 | 988k | break; | 820 | 13.3M | } | 821 | 13.3M | prev_ix &= ring_buffer_mask; | 822 | 13.3M | if (prev_ix.wrapping_add(best_len) > ring_buffer_mask | 823 | 13.3M | || prev_best_val != data[prev_ix.wrapping_add(best_len)]) | 824 | | { | 825 | 11.5M | continue; | 826 | 1.72M | } | 827 | | { | 828 | 1.72M | let unbroken_len = FindMatchLengthWithLimit( | 829 | 1.72M | data.split_at(prev_ix).1, | 830 | 1.72M | data.split_at(cur_ix_masked).1, | 831 | 1.72M | max_length, | 832 | | ); | 833 | 1.72M | if (unbroken_len >= 4) { | 834 | 1.71M | let len = fix_unbroken_len( | 835 | 1.71M | unbroken_len, | 836 | 1.71M | prev_ix, | 837 | 1.71M | cur_ix_masked, | 838 | 1.71M | ring_buffer_break, | 839 | | ); | 840 | | /* Comparing for >= 3 does not change the semantics, but just saves | 841 | | for a few unnecessary binary logarithms in backward reference | 842 | | score, since we are not interested in such short matches. */ | 843 | 1.71M | let score = BackwardReferenceScoreH9(len, backward, self.h9_opts); | 844 | 1.71M | if (best_score < score) { | 845 | 687k | best_score = score; | 846 | 687k | best_len = len; | 847 | 687k | out.len = best_len; | 848 | 687k | out.distance = backward; | 849 | 687k | out.score = best_score; | 850 | 687k | is_match_found = true; | 851 | 687k | if cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask { | 852 | 25 | break; | 853 | 687k | } | 854 | 687k | prev_best_val = data[cur_ix_masked.wrapping_add(best_len)]; | 855 | 1.02M | } | 856 | 11.4k | } | 857 | | } | 858 | | } | 859 | 1.69M | bucket[*self_num_key as usize & H9_BLOCK_MASK] = cur_ix as u32; | 860 | 1.69M | *self_num_key = self_num_key.wrapping_add(1); | 861 | 29 | } | 862 | 1.69M | if !is_match_found && dictionary.is_some() { | 863 | 1.13M | let (_, cur_data) = data.split_at(cur_ix_masked); | 864 | 1.13M | is_match_found = SearchInStaticDictionary( | 865 | 1.13M | dictionary.unwrap(), | 866 | 1.13M | dictionary_hash, | 867 | 1.13M | self, | 868 | 1.13M | cur_data, | 869 | 1.13M | max_length, | 870 | 1.13M | max_backward.wrapping_add(gap), | 871 | 1.13M | max_distance, | 872 | 1.13M | out, | 873 | 1.13M | false, | 874 | 1.13M | ); | 875 | 1.13M | } | 876 | 1.69M | is_match_found | 877 | 1.69M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch |
878 | | |
879 | 6.21M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { |
880 | 6.21M | let (_, data_window) = data.split_at((ix & mask)); |
881 | 6.21M | let key: u32 = self.HashBytes(data_window) as u32; |
882 | 6.21M | let self_num_key = &mut self.num_.slice_mut()[key as usize]; |
883 | 6.21M | let minor_ix: usize = (*self_num_key as usize & H9_BLOCK_MASK); |
884 | 6.21M | self.buckets_.slice_mut()[minor_ix.wrapping_add((key as usize) << H9_BLOCK_BITS)] = |
885 | 6.21M | ix as u32; |
886 | 6.21M | *self_num_key = self_num_key.wrapping_add(1); |
887 | 6.21M | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 879 | 6.21M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 880 | 6.21M | let (_, data_window) = data.split_at((ix & mask)); | 881 | 6.21M | let key: u32 = self.HashBytes(data_window) as u32; | 882 | 6.21M | let self_num_key = &mut self.num_.slice_mut()[key as usize]; | 883 | 6.21M | let minor_ix: usize = (*self_num_key as usize & H9_BLOCK_MASK); | 884 | 6.21M | self.buckets_.slice_mut()[minor_ix.wrapping_add((key as usize) << H9_BLOCK_BITS)] = | 885 | 6.21M | ix as u32; | 886 | 6.21M | *self_num_key = self_num_key.wrapping_add(1); | 887 | 6.21M | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::Store |
888 | 311k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { |
889 | 5.98M | for i in ix_start..ix_end { |
890 | 5.98M | self.Store(data, mask, i); |
891 | 5.98M | } |
892 | 311k | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 888 | 311k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 889 | 5.98M | for i in ix_start..ix_end { | 890 | 5.98M | self.Store(data, mask, i); | 891 | 5.98M | } | 892 | 311k | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::StoreRange |
893 | 0 | fn BulkStoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { |
894 | 0 | for i in ix_start..ix_end { |
895 | 0 | self.Store(data, mask, i); |
896 | 0 | } |
897 | 0 | } |
898 | 87 | fn Prepare(&mut self, _one_shot: bool, _input_size: usize, _data: &[u8]) -> HowPrepared { |
899 | 87 | if self.GetHasherCommon().is_prepared_ != 0 { |
900 | 87 | return HowPrepared::ALREADY_PREPARED; |
901 | 0 | } |
902 | 0 | for item in self.num_.slice_mut().iter_mut() { |
903 | 0 | *item = 0; |
904 | 0 | } |
905 | 0 | self.GetHasherCommon().is_prepared_ = 1; |
906 | 0 | HowPrepared::NEWLY_PREPARED |
907 | 87 | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 898 | 87 | fn Prepare(&mut self, _one_shot: bool, _input_size: usize, _data: &[u8]) -> HowPrepared { | 899 | 87 | if self.GetHasherCommon().is_prepared_ != 0 { | 900 | 87 | return HowPrepared::ALREADY_PREPARED; | 901 | 0 | } | 902 | 0 | for item in self.num_.slice_mut().iter_mut() { | 903 | 0 | *item = 0; | 904 | 0 | } | 905 | 0 | self.GetHasherCommon().is_prepared_ = 1; | 906 | 0 | HowPrepared::NEWLY_PREPARED | 907 | 87 | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::Prepare |
908 | 637 | fn StitchToPreviousBlock( |
909 | 637 | &mut self, |
910 | 637 | num_bytes: usize, |
911 | 637 | position: usize, |
912 | 637 | ringbuffer: &[u8], |
913 | 637 | ringbuffer_mask: usize, |
914 | 637 | ) { |
915 | 637 | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask) |
916 | 637 | } <brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 908 | 637 | fn StitchToPreviousBlock( | 909 | 637 | &mut self, | 910 | 637 | num_bytes: usize, | 911 | 637 | position: usize, | 912 | 637 | ringbuffer: &[u8], | 913 | 637 | ringbuffer_mask: usize, | 914 | 637 | ) { | 915 | 637 | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask) | 916 | 637 | } |
Unexecuted instantiation: <brotli::enc::backward_references::H9<_> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock |
917 | | } |
918 | | |
919 | | pub trait AdvHashSpecialization: PartialEq<Self> { |
920 | | fn get_hash_mask(&self) -> u64; |
921 | | fn set_hash_mask(&mut self, params_hash_len: i32); |
922 | | fn get_k_hash_mul(&self) -> u64; |
923 | | fn HashTypeLength(&self) -> usize; |
924 | | fn StoreLookahead(&self) -> usize; |
925 | | fn load_and_mix_word(&self, data: &[u8]) -> u64; |
926 | | fn hash_shift(&self) -> i32; |
927 | | fn bucket_size(&self) -> u32; |
928 | | fn block_mask(&self) -> u32; |
929 | | fn block_size(&self) -> u32; |
930 | | fn block_bits(&self) -> i32; |
931 | | } |
932 | | pub struct AdvHasher< |
933 | | Specialization: AdvHashSpecialization + Sized + Clone, |
934 | | Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>, |
935 | | > { |
936 | | pub GetHasherCommon: Struct1, |
937 | | pub specialization: Specialization, // contains hash_mask_ |
938 | | pub num: <Alloc as Allocator<u16>>::AllocatedMemory, |
939 | | pub buckets: <Alloc as Allocator<u32>>::AllocatedMemory, |
940 | | pub h9_opts: H9Opts, |
941 | | } |
942 | | |
943 | | impl< |
944 | | Specialization: AdvHashSpecialization + Sized + Clone, |
945 | | Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>, |
946 | | > PartialEq<AdvHasher<Specialization, Alloc>> for AdvHasher<Specialization, Alloc> |
947 | | { |
948 | 0 | fn eq(&self, other: &Self) -> bool { |
949 | 0 | self.GetHasherCommon == other.GetHasherCommon |
950 | 0 | && self.specialization == other.specialization |
951 | 0 | && self.num.slice() == other.num.slice() |
952 | 0 | && self.buckets.slice() == other.buckets.slice() |
953 | 0 | && self.h9_opts == other.h9_opts |
954 | 0 | } |
955 | | } |
956 | | |
957 | | #[derive(Clone, PartialEq)] |
958 | | pub struct HQ5Sub {} |
959 | | impl AdvHashSpecialization for HQ5Sub { |
960 | | #[inline(always)] |
961 | 673k | fn hash_shift(&self) -> i32 { |
962 | 673k | 32i32 - 14 // 32 - bucket_bits |
963 | 673k | } |
964 | | #[inline(always)] |
965 | 32.8k | fn bucket_size(&self) -> u32 { |
966 | 32.8k | 1 << 14 |
967 | 32.8k | } |
968 | | #[inline(always)] |
969 | 4.64M | fn block_bits(&self) -> i32 { |
970 | 4.64M | 4 |
971 | 4.64M | } |
972 | | #[inline(always)] |
973 | 646k | fn block_size(&self) -> u32 { |
974 | 646k | 1 << 4 |
975 | 646k | } |
976 | | #[inline(always)] |
977 | 7.05M | fn block_mask(&self) -> u32 { |
978 | 7.05M | (1 << 4) - 1 |
979 | 7.05M | } |
980 | | #[inline(always)] |
981 | 4.64M | fn get_hash_mask(&self) -> u64 { |
982 | | //return 0xffff_ffff_ffff_ffff; |
983 | 4.64M | 0xffff_ffff // make it 32 bit |
984 | 4.64M | } |
985 | | #[inline(always)] |
986 | 4.64M | fn get_k_hash_mul(&self) -> u64 { |
987 | 4.64M | kHashMul32 as u64 |
988 | 4.64M | } |
989 | | #[inline(always)] |
990 | 632k | fn load_and_mix_word(&self, data: &[u8]) -> u64 { |
991 | 632k | (BROTLI_UNALIGNED_LOAD32(data) as u64 * self.get_k_hash_mul()) & self.get_hash_mask() |
992 | 632k | } |
993 | | #[inline(always)] |
994 | 0 | fn set_hash_mask(&mut self, _params_hash_len: i32) {} |
995 | 300k | fn HashTypeLength(&self) -> usize { |
996 | 300k | 4 |
997 | 300k | } |
998 | | #[inline(always)] |
999 | 145k | fn StoreLookahead(&self) -> usize { |
1000 | 145k | 4 |
1001 | 145k | } |
1002 | | } |
1003 | | |
1004 | | #[derive(Clone, PartialEq)] |
1005 | | pub struct HQ7Sub {} |
1006 | | impl AdvHashSpecialization for HQ7Sub { |
1007 | | #[inline(always)] |
1008 | 402k | fn hash_shift(&self) -> i32 { |
1009 | 402k | 32i32 - 15 // 32 - bucket_bits |
1010 | 402k | } |
1011 | | #[inline(always)] |
1012 | 26.6k | fn bucket_size(&self) -> u32 { |
1013 | 26.6k | 1 << 15 |
1014 | 26.6k | } |
1015 | | #[inline(always)] |
1016 | 4.02M | fn block_bits(&self) -> i32 { |
1017 | 4.02M | 6 |
1018 | 4.02M | } |
1019 | | #[inline(always)] |
1020 | 363k | fn block_size(&self) -> u32 { |
1021 | 363k | 1 << 6 |
1022 | 363k | } |
1023 | | #[inline(always)] |
1024 | 6.19M | fn block_mask(&self) -> u32 { |
1025 | 6.19M | (1 << 6) - 1 |
1026 | 6.19M | } |
1027 | | #[inline(always)] |
1028 | 4.02M | fn get_hash_mask(&self) -> u64 { |
1029 | | //return 0xffff_ffff_ffff_ffff; |
1030 | 4.02M | 0xffff_ffff // make it 32 bit |
1031 | 4.02M | } |
1032 | | #[inline(always)] |
1033 | 4.02M | fn get_k_hash_mul(&self) -> u64 { |
1034 | 4.02M | kHashMul32 as u64 |
1035 | 4.02M | } |
1036 | | #[inline(always)] |
1037 | 368k | fn load_and_mix_word(&self, data: &[u8]) -> u64 { |
1038 | 368k | (BROTLI_UNALIGNED_LOAD32(data) as u64 * self.get_k_hash_mul()) & self.get_hash_mask() |
1039 | 368k | } |
1040 | | #[inline(always)] |
1041 | 0 | fn set_hash_mask(&mut self, _params_hash_len: i32) {} |
1042 | 197k | fn HashTypeLength(&self) -> usize { |
1043 | 197k | 4 |
1044 | 197k | } |
1045 | | #[inline(always)] |
1046 | 89.8k | fn StoreLookahead(&self) -> usize { |
1047 | 89.8k | 4 |
1048 | 89.8k | } |
1049 | | } |
1050 | | |
1051 | | #[derive(Clone, PartialEq)] |
1052 | | pub struct H5Sub { |
1053 | | pub hash_shift_: i32, |
1054 | | pub bucket_size_: u32, |
1055 | | pub block_mask_: u32, |
1056 | | pub block_bits_: i32, |
1057 | | } |
1058 | | |
1059 | | impl AdvHashSpecialization for H5Sub { |
1060 | | #[inline(always)] |
1061 | 884k | fn hash_shift(&self) -> i32 { |
1062 | 884k | self.hash_shift_ |
1063 | 884k | } |
1064 | 47.2k | fn bucket_size(&self) -> u32 { |
1065 | 47.2k | self.bucket_size_ |
1066 | 47.2k | } |
1067 | 5.79M | fn block_bits(&self) -> i32 { |
1068 | 5.79M | self.block_bits_ |
1069 | 5.79M | } |
1070 | 922k | fn block_size(&self) -> u32 { |
1071 | 922k | 1 << self.block_bits_ |
1072 | 922k | } |
1073 | 12.7M | fn block_mask(&self) -> u32 { |
1074 | 12.7M | self.block_mask_ |
1075 | 12.7M | } |
1076 | 5.79M | fn get_hash_mask(&self) -> u64 { |
1077 | | //return 0xffff_ffff_ffff_ffff; |
1078 | 5.79M | 0xffff_ffff // make it 32 bit |
1079 | 5.79M | } |
1080 | 5.79M | fn get_k_hash_mul(&self) -> u64 { |
1081 | 5.79M | kHashMul32 as u64 |
1082 | 5.79M | } |
1083 | 825k | fn load_and_mix_word(&self, data: &[u8]) -> u64 { |
1084 | 825k | (BROTLI_UNALIGNED_LOAD32(data) as u64 * self.get_k_hash_mul()) & self.get_hash_mask() |
1085 | 825k | } |
1086 | | #[allow(unused_variables)] |
1087 | 0 | fn set_hash_mask(&mut self, params_hash_len: i32) {} |
1088 | 443k | fn HashTypeLength(&self) -> usize { |
1089 | 443k | 4 |
1090 | 443k | } |
1091 | 181k | fn StoreLookahead(&self) -> usize { |
1092 | 181k | 4 |
1093 | 181k | } |
1094 | | } |
1095 | | |
1096 | | #[derive(Clone, PartialEq)] |
1097 | | pub struct H6Sub { |
1098 | | pub hash_mask: u64, |
1099 | | pub hash_shift_: i32, |
1100 | | pub bucket_size_: u32, |
1101 | | pub block_mask_: u32, |
1102 | | pub block_bits_: i32, |
1103 | | } |
1104 | | |
1105 | | impl AdvHashSpecialization for H6Sub { |
1106 | | #[inline(always)] |
1107 | 20.0M | fn hash_shift(&self) -> i32 { |
1108 | 20.0M | self.hash_shift_ |
1109 | 20.0M | } |
1110 | | #[inline(always)] |
1111 | 0 | fn bucket_size(&self) -> u32 { |
1112 | 0 | self.bucket_size_ |
1113 | 0 | } |
1114 | 20.0M | fn block_bits(&self) -> i32 { |
1115 | 20.0M | self.block_bits_ |
1116 | 20.0M | } |
1117 | 6.67M | fn block_size(&self) -> u32 { |
1118 | 6.67M | 1 << self.block_bits_ |
1119 | 6.67M | } |
1120 | | #[inline(always)] |
1121 | 67.8M | fn block_mask(&self) -> u32 { |
1122 | 67.8M | self.block_mask_ |
1123 | 67.8M | } |
1124 | | #[inline(always)] |
1125 | 20.0M | fn get_hash_mask(&self) -> u64 { |
1126 | 20.0M | self.hash_mask |
1127 | 20.0M | } |
1128 | | #[inline(always)] |
1129 | 0 | fn set_hash_mask(&mut self, params_hash_len: i32) { |
1130 | | // FIXME: this assumes params_hash_len is fairly small, or else it may result in a negative shift value |
1131 | 0 | self.hash_mask = u64::MAX >> (64i32 - 8i32 * params_hash_len); |
1132 | 0 | } |
1133 | | #[inline(always)] |
1134 | 20.0M | fn get_k_hash_mul(&self) -> u64 { |
1135 | 20.0M | kHashMul64Long |
1136 | 20.0M | } |
1137 | | #[inline(always)] |
1138 | 20.0M | fn load_and_mix_word(&self, data: &[u8]) -> u64 { |
1139 | 20.0M | (BROTLI_UNALIGNED_LOAD64(data) & self.get_hash_mask()).wrapping_mul(self.get_k_hash_mul()) |
1140 | 20.0M | } |
1141 | | #[inline(always)] |
1142 | 3.14M | fn HashTypeLength(&self) -> usize { |
1143 | 3.14M | 8 |
1144 | 3.14M | } |
1145 | | #[inline(always)] |
1146 | 1.28M | fn StoreLookahead(&self) -> usize { |
1147 | 1.28M | 8 |
1148 | 1.28M | } |
1149 | | } |
1150 | | |
1151 | 618k | fn BackwardReferencePenaltyUsingLastDistance(distance_short_code: usize) -> u64 { |
1152 | | // FIXME?: double bitwise AND with the same value? |
1153 | 618k | (39u64).wrapping_add((0x0001_ca10_u64 >> (distance_short_code & 0x0e) & 0x0e)) |
1154 | 618k | } |
1155 | | |
1156 | | impl< |
1157 | | Specialization: AdvHashSpecialization + Clone, |
1158 | | Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>, |
1159 | | > AdvHasher<Specialization, Alloc> |
1160 | | { |
1161 | | // 7 opt |
1162 | | // returns a new ix_start |
1163 | 745k | fn StoreRangeOptBatch( |
1164 | 745k | &mut self, |
1165 | 745k | data: &[u8], |
1166 | 745k | mask: usize, |
1167 | 745k | ix_start: usize, |
1168 | 745k | ix_end: usize, |
1169 | 745k | ) -> usize { |
1170 | 745k | let lookahead = self.specialization.StoreLookahead(); |
1171 | 745k | if ix_end >= ix_start + lookahead * 2 && lookahead == 4 { |
1172 | 52.8k | let num = self.num.slice_mut(); |
1173 | 52.8k | let buckets = self.buckets.slice_mut(); |
1174 | 52.8k | assert_eq!(num.len(), self.specialization.bucket_size() as usize); |
1175 | 52.8k | assert_eq!( |
1176 | 52.8k | buckets.len(), |
1177 | 52.8k | self.specialization.bucket_size() as usize |
1178 | 52.8k | * self.specialization.block_size() as usize |
1179 | | ); |
1180 | 52.8k | let shift = self.specialization.hash_shift(); |
1181 | 52.8k | let chunk_count = (ix_end - ix_start) / 4; |
1182 | 3.07M | for chunk_id in 0..chunk_count { |
1183 | 3.07M | let i = (ix_start + chunk_id * 4) & mask; |
1184 | 3.07M | let ffffffff = 0xffff_ffff; |
1185 | 3.07M | let word = u64::from(data[i]) |
1186 | 3.07M | | (u64::from(data[i + 1]) << 8) |
1187 | 3.07M | | (u64::from(data[i + 2]) << 16) |
1188 | 3.07M | | (u64::from(data[i + 3]) << 24) |
1189 | 3.07M | | (u64::from(data[i + 4]) << 32) |
1190 | 3.07M | | (u64::from(data[i + 5]) << 40) |
1191 | 3.07M | | (u64::from(data[i + 6]) << 48); |
1192 | 3.07M | let mixed0 = ((((word & ffffffff) * self.specialization.get_k_hash_mul()) |
1193 | 3.07M | & self.specialization.get_hash_mask()) |
1194 | 3.07M | >> shift) as usize; |
1195 | 3.07M | let mixed1 = (((((word >> 8) & ffffffff) * self.specialization.get_k_hash_mul()) |
1196 | 3.07M | & self.specialization.get_hash_mask()) |
1197 | 3.07M | >> shift) as usize; |
1198 | 3.07M | let mixed2 = (((((word >> 16) & ffffffff) * self.specialization.get_k_hash_mul()) |
1199 | 3.07M | & self.specialization.get_hash_mask()) |
1200 | 3.07M | >> shift) as usize; |
1201 | 3.07M | let mixed3 = (((((word >> 24) & ffffffff) * self.specialization.get_k_hash_mul()) |
1202 | 3.07M | & self.specialization.get_hash_mask()) |
1203 | 3.07M | >> shift) as usize; |
1204 | 3.07M | let mut num_ref0 = u32::from(num[mixed0]); |
1205 | 3.07M | num[mixed0] = num_ref0.wrapping_add(1) as u16; |
1206 | 3.07M | num_ref0 &= self.specialization.block_mask(); |
1207 | 3.07M | let mut num_ref1 = u32::from(num[mixed1]); |
1208 | 3.07M | num[mixed1] = num_ref1.wrapping_add(1) as u16; |
1209 | 3.07M | num_ref1 &= self.specialization.block_mask(); |
1210 | 3.07M | let mut num_ref2 = u32::from(num[mixed2]); |
1211 | 3.07M | num[mixed2] = num_ref2.wrapping_add(1) as u16; |
1212 | 3.07M | num_ref2 &= self.specialization.block_mask(); |
1213 | 3.07M | let mut num_ref3 = u32::from(num[mixed3]); |
1214 | 3.07M | num[mixed3] = num_ref3.wrapping_add(1) as u16; |
1215 | 3.07M | num_ref3 &= self.specialization.block_mask(); |
1216 | 3.07M | let offset0: usize = |
1217 | 3.07M | (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; |
1218 | 3.07M | let offset1: usize = |
1219 | 3.07M | (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; |
1220 | 3.07M | let offset2: usize = |
1221 | 3.07M | (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; |
1222 | 3.07M | let offset3: usize = |
1223 | 3.07M | (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; |
1224 | 3.07M | buckets[offset0] = (i) as u32; |
1225 | 3.07M | buckets[offset1] = (i + 1) as u32; |
1226 | 3.07M | buckets[offset2] = (i + 2) as u32; |
1227 | 3.07M | buckets[offset3] = (i + 3) as u32; |
1228 | 3.07M | } |
1229 | 52.8k | return ix_start + chunk_count * 4; |
1230 | 692k | } |
1231 | 692k | ix_start |
1232 | 745k | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc>>::StoreRangeOptBatch Line | Count | Source | 1163 | 108k | fn StoreRangeOptBatch( | 1164 | 108k | &mut self, | 1165 | 108k | data: &[u8], | 1166 | 108k | mask: usize, | 1167 | 108k | ix_start: usize, | 1168 | 108k | ix_end: usize, | 1169 | 108k | ) -> usize { | 1170 | 108k | let lookahead = self.specialization.StoreLookahead(); | 1171 | 108k | if ix_end >= ix_start + lookahead * 2 && lookahead == 4 { | 1172 | 23.6k | let num = self.num.slice_mut(); | 1173 | 23.6k | let buckets = self.buckets.slice_mut(); | 1174 | 23.6k | assert_eq!(num.len(), self.specialization.bucket_size() as usize); | 1175 | 23.6k | assert_eq!( | 1176 | 23.6k | buckets.len(), | 1177 | 23.6k | self.specialization.bucket_size() as usize | 1178 | 23.6k | * self.specialization.block_size() as usize | 1179 | | ); | 1180 | 23.6k | let shift = self.specialization.hash_shift(); | 1181 | 23.6k | let chunk_count = (ix_end - ix_start) / 4; | 1182 | 1.20M | for chunk_id in 0..chunk_count { | 1183 | 1.20M | let i = (ix_start + chunk_id * 4) & mask; | 1184 | 1.20M | let ffffffff = 0xffff_ffff; | 1185 | 1.20M | let word = u64::from(data[i]) | 1186 | 1.20M | | (u64::from(data[i + 1]) << 8) | 1187 | 1.20M | | (u64::from(data[i + 2]) << 16) | 1188 | 1.20M | | (u64::from(data[i + 3]) << 24) | 1189 | 1.20M | | (u64::from(data[i + 4]) << 32) | 1190 | 1.20M | | (u64::from(data[i + 5]) << 40) | 1191 | 1.20M | | (u64::from(data[i + 6]) << 48); | 1192 | 1.20M | let mixed0 = ((((word & ffffffff) * self.specialization.get_k_hash_mul()) | 1193 | 1.20M | & self.specialization.get_hash_mask()) | 1194 | 1.20M | >> shift) as usize; | 1195 | 1.20M | let mixed1 = (((((word >> 8) & ffffffff) * self.specialization.get_k_hash_mul()) | 1196 | 1.20M | & self.specialization.get_hash_mask()) | 1197 | 1.20M | >> shift) as usize; | 1198 | 1.20M | let mixed2 = (((((word >> 16) & ffffffff) * self.specialization.get_k_hash_mul()) | 1199 | 1.20M | & self.specialization.get_hash_mask()) | 1200 | 1.20M | >> shift) as usize; | 1201 | 1.20M | let mixed3 = (((((word >> 24) & ffffffff) * self.specialization.get_k_hash_mul()) | 1202 | 1.20M | & self.specialization.get_hash_mask()) | 1203 | 1.20M | >> shift) as usize; | 1204 | 1.20M | let mut num_ref0 = u32::from(num[mixed0]); | 1205 | 1.20M | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1206 | 1.20M | num_ref0 &= self.specialization.block_mask(); | 1207 | 1.20M | let mut num_ref1 = u32::from(num[mixed1]); | 1208 | 1.20M | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1209 | 1.20M | num_ref1 &= self.specialization.block_mask(); | 1210 | 1.20M | let mut num_ref2 = u32::from(num[mixed2]); | 1211 | 1.20M | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1212 | 1.20M | num_ref2 &= self.specialization.block_mask(); | 1213 | 1.20M | let mut num_ref3 = u32::from(num[mixed3]); | 1214 | 1.20M | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1215 | 1.20M | num_ref3 &= self.specialization.block_mask(); | 1216 | 1.20M | let offset0: usize = | 1217 | 1.20M | (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1218 | 1.20M | let offset1: usize = | 1219 | 1.20M | (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1220 | 1.20M | let offset2: usize = | 1221 | 1.20M | (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1222 | 1.20M | let offset3: usize = | 1223 | 1.20M | (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1224 | 1.20M | buckets[offset0] = (i) as u32; | 1225 | 1.20M | buckets[offset1] = (i + 1) as u32; | 1226 | 1.20M | buckets[offset2] = (i + 2) as u32; | 1227 | 1.20M | buckets[offset3] = (i + 3) as u32; | 1228 | 1.20M | } | 1229 | 23.6k | return ix_start + chunk_count * 4; | 1230 | 84.8k | } | 1231 | 84.8k | ix_start | 1232 | 108k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc>>::StoreRangeOptBatch Line | Count | Source | 1163 | 497k | fn StoreRangeOptBatch( | 1164 | 497k | &mut self, | 1165 | 497k | data: &[u8], | 1166 | 497k | mask: usize, | 1167 | 497k | ix_start: usize, | 1168 | 497k | ix_end: usize, | 1169 | 497k | ) -> usize { | 1170 | 497k | let lookahead = self.specialization.StoreLookahead(); | 1171 | 497k | if ix_end >= ix_start + lookahead * 2 && lookahead == 4 { | 1172 | 0 | let num = self.num.slice_mut(); | 1173 | 0 | let buckets = self.buckets.slice_mut(); | 1174 | 0 | assert_eq!(num.len(), self.specialization.bucket_size() as usize); | 1175 | 0 | assert_eq!( | 1176 | 0 | buckets.len(), | 1177 | 0 | self.specialization.bucket_size() as usize | 1178 | 0 | * self.specialization.block_size() as usize | 1179 | | ); | 1180 | 0 | let shift = self.specialization.hash_shift(); | 1181 | 0 | let chunk_count = (ix_end - ix_start) / 4; | 1182 | 0 | for chunk_id in 0..chunk_count { | 1183 | 0 | let i = (ix_start + chunk_id * 4) & mask; | 1184 | 0 | let ffffffff = 0xffff_ffff; | 1185 | 0 | let word = u64::from(data[i]) | 1186 | 0 | | (u64::from(data[i + 1]) << 8) | 1187 | 0 | | (u64::from(data[i + 2]) << 16) | 1188 | 0 | | (u64::from(data[i + 3]) << 24) | 1189 | 0 | | (u64::from(data[i + 4]) << 32) | 1190 | 0 | | (u64::from(data[i + 5]) << 40) | 1191 | 0 | | (u64::from(data[i + 6]) << 48); | 1192 | 0 | let mixed0 = ((((word & ffffffff) * self.specialization.get_k_hash_mul()) | 1193 | 0 | & self.specialization.get_hash_mask()) | 1194 | 0 | >> shift) as usize; | 1195 | 0 | let mixed1 = (((((word >> 8) & ffffffff) * self.specialization.get_k_hash_mul()) | 1196 | 0 | & self.specialization.get_hash_mask()) | 1197 | 0 | >> shift) as usize; | 1198 | 0 | let mixed2 = (((((word >> 16) & ffffffff) * self.specialization.get_k_hash_mul()) | 1199 | 0 | & self.specialization.get_hash_mask()) | 1200 | 0 | >> shift) as usize; | 1201 | 0 | let mixed3 = (((((word >> 24) & ffffffff) * self.specialization.get_k_hash_mul()) | 1202 | 0 | & self.specialization.get_hash_mask()) | 1203 | 0 | >> shift) as usize; | 1204 | 0 | let mut num_ref0 = u32::from(num[mixed0]); | 1205 | 0 | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1206 | 0 | num_ref0 &= self.specialization.block_mask(); | 1207 | 0 | let mut num_ref1 = u32::from(num[mixed1]); | 1208 | 0 | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1209 | 0 | num_ref1 &= self.specialization.block_mask(); | 1210 | 0 | let mut num_ref2 = u32::from(num[mixed2]); | 1211 | 0 | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1212 | 0 | num_ref2 &= self.specialization.block_mask(); | 1213 | 0 | let mut num_ref3 = u32::from(num[mixed3]); | 1214 | 0 | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1215 | 0 | num_ref3 &= self.specialization.block_mask(); | 1216 | 0 | let offset0: usize = | 1217 | 0 | (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1218 | 0 | let offset1: usize = | 1219 | 0 | (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1220 | 0 | let offset2: usize = | 1221 | 0 | (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1222 | 0 | let offset3: usize = | 1223 | 0 | (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1224 | 0 | buckets[offset0] = (i) as u32; | 1225 | 0 | buckets[offset1] = (i + 1) as u32; | 1226 | 0 | buckets[offset2] = (i + 2) as u32; | 1227 | 0 | buckets[offset3] = (i + 3) as u32; | 1228 | 0 | } | 1229 | 0 | return ix_start + chunk_count * 4; | 1230 | 497k | } | 1231 | 497k | ix_start | 1232 | 497k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc>>::StoreRangeOptBatch Line | Count | Source | 1163 | 93.3k | fn StoreRangeOptBatch( | 1164 | 93.3k | &mut self, | 1165 | 93.3k | data: &[u8], | 1166 | 93.3k | mask: usize, | 1167 | 93.3k | ix_start: usize, | 1168 | 93.3k | ix_end: usize, | 1169 | 93.3k | ) -> usize { | 1170 | 93.3k | let lookahead = self.specialization.StoreLookahead(); | 1171 | 93.3k | if ix_end >= ix_start + lookahead * 2 && lookahead == 4 { | 1172 | 16.1k | let num = self.num.slice_mut(); | 1173 | 16.1k | let buckets = self.buckets.slice_mut(); | 1174 | 16.1k | assert_eq!(num.len(), self.specialization.bucket_size() as usize); | 1175 | 16.1k | assert_eq!( | 1176 | 16.1k | buckets.len(), | 1177 | 16.1k | self.specialization.bucket_size() as usize | 1178 | 16.1k | * self.specialization.block_size() as usize | 1179 | | ); | 1180 | 16.1k | let shift = self.specialization.hash_shift(); | 1181 | 16.1k | let chunk_count = (ix_end - ix_start) / 4; | 1182 | 977k | for chunk_id in 0..chunk_count { | 1183 | 977k | let i = (ix_start + chunk_id * 4) & mask; | 1184 | 977k | let ffffffff = 0xffff_ffff; | 1185 | 977k | let word = u64::from(data[i]) | 1186 | 977k | | (u64::from(data[i + 1]) << 8) | 1187 | 977k | | (u64::from(data[i + 2]) << 16) | 1188 | 977k | | (u64::from(data[i + 3]) << 24) | 1189 | 977k | | (u64::from(data[i + 4]) << 32) | 1190 | 977k | | (u64::from(data[i + 5]) << 40) | 1191 | 977k | | (u64::from(data[i + 6]) << 48); | 1192 | 977k | let mixed0 = ((((word & ffffffff) * self.specialization.get_k_hash_mul()) | 1193 | 977k | & self.specialization.get_hash_mask()) | 1194 | 977k | >> shift) as usize; | 1195 | 977k | let mixed1 = (((((word >> 8) & ffffffff) * self.specialization.get_k_hash_mul()) | 1196 | 977k | & self.specialization.get_hash_mask()) | 1197 | 977k | >> shift) as usize; | 1198 | 977k | let mixed2 = (((((word >> 16) & ffffffff) * self.specialization.get_k_hash_mul()) | 1199 | 977k | & self.specialization.get_hash_mask()) | 1200 | 977k | >> shift) as usize; | 1201 | 977k | let mixed3 = (((((word >> 24) & ffffffff) * self.specialization.get_k_hash_mul()) | 1202 | 977k | & self.specialization.get_hash_mask()) | 1203 | 977k | >> shift) as usize; | 1204 | 977k | let mut num_ref0 = u32::from(num[mixed0]); | 1205 | 977k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1206 | 977k | num_ref0 &= self.specialization.block_mask(); | 1207 | 977k | let mut num_ref1 = u32::from(num[mixed1]); | 1208 | 977k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1209 | 977k | num_ref1 &= self.specialization.block_mask(); | 1210 | 977k | let mut num_ref2 = u32::from(num[mixed2]); | 1211 | 977k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1212 | 977k | num_ref2 &= self.specialization.block_mask(); | 1213 | 977k | let mut num_ref3 = u32::from(num[mixed3]); | 1214 | 977k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1215 | 977k | num_ref3 &= self.specialization.block_mask(); | 1216 | 977k | let offset0: usize = | 1217 | 977k | (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1218 | 977k | let offset1: usize = | 1219 | 977k | (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1220 | 977k | let offset2: usize = | 1221 | 977k | (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1222 | 977k | let offset3: usize = | 1223 | 977k | (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1224 | 977k | buckets[offset0] = (i) as u32; | 1225 | 977k | buckets[offset1] = (i + 1) as u32; | 1226 | 977k | buckets[offset2] = (i + 2) as u32; | 1227 | 977k | buckets[offset3] = (i + 3) as u32; | 1228 | 977k | } | 1229 | 16.1k | return ix_start + chunk_count * 4; | 1230 | 77.2k | } | 1231 | 77.2k | ix_start | 1232 | 93.3k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc>>::StoreRangeOptBatch Line | Count | Source | 1163 | 46.7k | fn StoreRangeOptBatch( | 1164 | 46.7k | &mut self, | 1165 | 46.7k | data: &[u8], | 1166 | 46.7k | mask: usize, | 1167 | 46.7k | ix_start: usize, | 1168 | 46.7k | ix_end: usize, | 1169 | 46.7k | ) -> usize { | 1170 | 46.7k | let lookahead = self.specialization.StoreLookahead(); | 1171 | 46.7k | if ix_end >= ix_start + lookahead * 2 && lookahead == 4 { | 1172 | 13.0k | let num = self.num.slice_mut(); | 1173 | 13.0k | let buckets = self.buckets.slice_mut(); | 1174 | 13.0k | assert_eq!(num.len(), self.specialization.bucket_size() as usize); | 1175 | 13.0k | assert_eq!( | 1176 | 13.0k | buckets.len(), | 1177 | 13.0k | self.specialization.bucket_size() as usize | 1178 | 13.0k | * self.specialization.block_size() as usize | 1179 | | ); | 1180 | 13.0k | let shift = self.specialization.hash_shift(); | 1181 | 13.0k | let chunk_count = (ix_end - ix_start) / 4; | 1182 | 892k | for chunk_id in 0..chunk_count { | 1183 | 892k | let i = (ix_start + chunk_id * 4) & mask; | 1184 | 892k | let ffffffff = 0xffff_ffff; | 1185 | 892k | let word = u64::from(data[i]) | 1186 | 892k | | (u64::from(data[i + 1]) << 8) | 1187 | 892k | | (u64::from(data[i + 2]) << 16) | 1188 | 892k | | (u64::from(data[i + 3]) << 24) | 1189 | 892k | | (u64::from(data[i + 4]) << 32) | 1190 | 892k | | (u64::from(data[i + 5]) << 40) | 1191 | 892k | | (u64::from(data[i + 6]) << 48); | 1192 | 892k | let mixed0 = ((((word & ffffffff) * self.specialization.get_k_hash_mul()) | 1193 | 892k | & self.specialization.get_hash_mask()) | 1194 | 892k | >> shift) as usize; | 1195 | 892k | let mixed1 = (((((word >> 8) & ffffffff) * self.specialization.get_k_hash_mul()) | 1196 | 892k | & self.specialization.get_hash_mask()) | 1197 | 892k | >> shift) as usize; | 1198 | 892k | let mixed2 = (((((word >> 16) & ffffffff) * self.specialization.get_k_hash_mul()) | 1199 | 892k | & self.specialization.get_hash_mask()) | 1200 | 892k | >> shift) as usize; | 1201 | 892k | let mixed3 = (((((word >> 24) & ffffffff) * self.specialization.get_k_hash_mul()) | 1202 | 892k | & self.specialization.get_hash_mask()) | 1203 | 892k | >> shift) as usize; | 1204 | 892k | let mut num_ref0 = u32::from(num[mixed0]); | 1205 | 892k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1206 | 892k | num_ref0 &= self.specialization.block_mask(); | 1207 | 892k | let mut num_ref1 = u32::from(num[mixed1]); | 1208 | 892k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1209 | 892k | num_ref1 &= self.specialization.block_mask(); | 1210 | 892k | let mut num_ref2 = u32::from(num[mixed2]); | 1211 | 892k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1212 | 892k | num_ref2 &= self.specialization.block_mask(); | 1213 | 892k | let mut num_ref3 = u32::from(num[mixed3]); | 1214 | 892k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1215 | 892k | num_ref3 &= self.specialization.block_mask(); | 1216 | 892k | let offset0: usize = | 1217 | 892k | (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1218 | 892k | let offset1: usize = | 1219 | 892k | (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1220 | 892k | let offset2: usize = | 1221 | 892k | (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1222 | 892k | let offset3: usize = | 1223 | 892k | (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1224 | 892k | buckets[offset0] = (i) as u32; | 1225 | 892k | buckets[offset1] = (i + 1) as u32; | 1226 | 892k | buckets[offset2] = (i + 2) as u32; | 1227 | 892k | buckets[offset3] = (i + 3) as u32; | 1228 | 892k | } | 1229 | 13.0k | return ix_start + chunk_count * 4; | 1230 | 33.7k | } | 1231 | 33.7k | ix_start | 1232 | 46.7k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _>>::StoreRangeOptBatch |
1233 | | |
1234 | 0 | fn BulkStoreRangeOptMemFetch( |
1235 | 0 | &mut self, |
1236 | 0 | data: &[u8], |
1237 | 0 | mask: usize, |
1238 | 0 | ix_start: usize, |
1239 | 0 | ix_end: usize, |
1240 | 0 | ) -> usize { |
1241 | | const REG_SIZE: usize = 32usize; |
1242 | 0 | let lookahead = self.specialization.StoreLookahead(); |
1243 | 0 | if mask == usize::MAX && ix_end > ix_start + REG_SIZE && lookahead == 4 { |
1244 | | const lookahead4: usize = 4; |
1245 | 0 | assert_eq!(lookahead4, lookahead); |
1246 | 0 | let mut data64 = [0u8; REG_SIZE + lookahead4 - 1]; |
1247 | 0 | let del = (ix_end - ix_start) / REG_SIZE; |
1248 | 0 | let num = self.num.slice_mut(); |
1249 | 0 | let buckets = self.buckets.slice_mut(); |
1250 | 0 | assert_eq!(num.len(), self.specialization.bucket_size() as usize); |
1251 | 0 | assert_eq!( |
1252 | 0 | buckets.len(), |
1253 | 0 | self.specialization.bucket_size() as usize |
1254 | 0 | * self.specialization.block_size() as usize |
1255 | | ); |
1256 | 0 | let shift = self.specialization.hash_shift(); |
1257 | 0 | for chunk_id in 0..del { |
1258 | 0 | let ix_offset = ix_start + chunk_id * REG_SIZE; |
1259 | 0 | data64[..REG_SIZE + lookahead4 - 1].clone_from_slice( |
1260 | 0 | data.split_at(ix_offset) |
1261 | 0 | .1 |
1262 | 0 | .split_at(REG_SIZE + lookahead4 - 1) |
1263 | 0 | .0, |
1264 | | ); |
1265 | 0 | for quad_index in 0..(REG_SIZE >> 2) { |
1266 | 0 | let i = quad_index << 2; |
1267 | 0 | let ffffffff = 0xffff_ffff; |
1268 | 0 | let word = u64::from(data64[i]) |
1269 | 0 | | (u64::from(data64[i + 1]) << 8) |
1270 | 0 | | (u64::from(data64[i + 2]) << 16) |
1271 | 0 | | (u64::from(data64[i + 3]) << 24) |
1272 | 0 | | (u64::from(data64[i + 4]) << 32) |
1273 | 0 | | (u64::from(data64[i + 5]) << 40) |
1274 | 0 | | (u64::from(data64[i + 6]) << 48); |
1275 | 0 | let mixed0 = ((((word & ffffffff) * self.specialization.get_k_hash_mul()) |
1276 | 0 | & self.specialization.get_hash_mask()) |
1277 | 0 | >> shift) as usize; |
1278 | 0 | let mixed1 = (((((word >> 8) & ffffffff) |
1279 | 0 | * self.specialization.get_k_hash_mul()) |
1280 | 0 | & self.specialization.get_hash_mask()) |
1281 | 0 | >> shift) as usize; |
1282 | 0 | let mixed2 = (((((word >> 16) & ffffffff) |
1283 | 0 | * self.specialization.get_k_hash_mul()) |
1284 | 0 | & self.specialization.get_hash_mask()) |
1285 | 0 | >> shift) as usize; |
1286 | 0 | let mixed3 = (((((word >> 24) & ffffffff) |
1287 | 0 | * self.specialization.get_k_hash_mul()) |
1288 | 0 | & self.specialization.get_hash_mask()) |
1289 | 0 | >> shift) as usize; |
1290 | 0 | let mut num_ref0 = u32::from(num[mixed0]); |
1291 | 0 | num[mixed0] = num_ref0.wrapping_add(1) as u16; |
1292 | 0 | num_ref0 &= self.specialization.block_mask(); |
1293 | 0 | let mut num_ref1 = u32::from(num[mixed1]); |
1294 | 0 | num[mixed1] = num_ref1.wrapping_add(1) as u16; |
1295 | 0 | num_ref1 &= self.specialization.block_mask(); |
1296 | 0 | let mut num_ref2 = u32::from(num[mixed2]); |
1297 | 0 | num[mixed2] = num_ref2.wrapping_add(1) as u16; |
1298 | 0 | num_ref2 &= self.specialization.block_mask(); |
1299 | 0 | let mut num_ref3 = u32::from(num[mixed3]); |
1300 | 0 | num[mixed3] = num_ref3.wrapping_add(1) as u16; |
1301 | 0 | num_ref3 &= self.specialization.block_mask(); |
1302 | 0 | let offset0: usize = |
1303 | 0 | (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; |
1304 | 0 | let offset1: usize = |
1305 | 0 | (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; |
1306 | 0 | let offset2: usize = |
1307 | 0 | (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; |
1308 | 0 | let offset3: usize = |
1309 | 0 | (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; |
1310 | 0 | buckets[offset0] = (ix_offset + i) as u32; |
1311 | 0 | buckets[offset1] = (ix_offset + i + 1) as u32; |
1312 | 0 | buckets[offset2] = (ix_offset + i + 2) as u32; |
1313 | 0 | buckets[offset3] = (ix_offset + i + 3) as u32; |
1314 | 0 | } |
1315 | | } |
1316 | 0 | return ix_start + del * REG_SIZE; |
1317 | 0 | } |
1318 | 0 | ix_start |
1319 | 0 | } |
1320 | | |
1321 | | #[cfg(feature = "benchmark")] |
1322 | | fn BulkStoreRangeOptMemFetchLazyDupeUpdate( |
1323 | | &mut self, |
1324 | | data: &[u8], |
1325 | | mask: usize, |
1326 | | ix_start: usize, |
1327 | | ix_end: usize, |
1328 | | ) -> usize { |
1329 | | const REG_SIZE: usize = 32usize; |
1330 | | let lookahead = self.specialization.StoreLookahead(); |
1331 | | if mask == usize::MAX && ix_end > ix_start + REG_SIZE && lookahead == 4 { |
1332 | | const lookahead4: usize = 4; |
1333 | | assert_eq!(lookahead4, lookahead); |
1334 | | let mut data64 = [0u8; REG_SIZE + lookahead4]; |
1335 | | let del = (ix_end - ix_start) / REG_SIZE; |
1336 | | let num = self.num.slice_mut(); |
1337 | | let buckets = self.buckets.slice_mut(); |
1338 | | assert_eq!(num.len(), self.specialization.bucket_size() as usize); |
1339 | | assert_eq!( |
1340 | | buckets.len(), |
1341 | | self.specialization.bucket_size() as usize |
1342 | | * self.specialization.block_size() as usize |
1343 | | ); |
1344 | | let shift = self.specialization.hash_shift(); |
1345 | | for chunk_id in 0..del { |
1346 | | let ix_offset = ix_start + chunk_id * REG_SIZE; |
1347 | | data64[..REG_SIZE + lookahead4] |
1348 | | .clone_from_slice(data.split_at(ix_offset).1.split_at(REG_SIZE + lookahead4).0); |
1349 | | for quad_index in 0..(REG_SIZE >> 2) { |
1350 | | let i = quad_index << 2; |
1351 | | let ffffffff = 0xffff_ffff; |
1352 | | let word = u64::from(data64[i]) |
1353 | | | (u64::from(data64[i + 1]) << 8) |
1354 | | | (u64::from(data64[i + 2]) << 16) |
1355 | | | (u64::from(data64[i + 3]) << 24) |
1356 | | | (u64::from(data64[i + 4]) << 32) |
1357 | | | (u64::from(data64[i + 5]) << 40) |
1358 | | | (u64::from(data64[i + 6]) << 48); |
1359 | | let mixed0 = ((((word & ffffffff) * self.specialization.get_k_hash_mul()) |
1360 | | & self.specialization.get_hash_mask()) |
1361 | | >> shift) as usize; |
1362 | | let mixed1 = (((((word >> 8) & ffffffff) |
1363 | | * self.specialization.get_k_hash_mul()) |
1364 | | & self.specialization.get_hash_mask()) |
1365 | | >> shift) as usize; |
1366 | | let mixed2 = (((((word >> 16) & ffffffff) |
1367 | | * self.specialization.get_k_hash_mul()) |
1368 | | & self.specialization.get_hash_mask()) |
1369 | | >> shift) as usize; |
1370 | | let mixed3 = (((((word >> 24) & ffffffff) |
1371 | | * self.specialization.get_k_hash_mul()) |
1372 | | & self.specialization.get_hash_mask()) |
1373 | | >> shift) as usize; |
1374 | | let mut num_ref0 = u32::from(num[mixed0]); |
1375 | | let mut num_ref1 = u32::from(num[mixed1]); |
1376 | | let mut num_ref2 = u32::from(num[mixed2]); |
1377 | | let mut num_ref3 = u32::from(num[mixed3]); |
1378 | | num[mixed0] = num_ref0.wrapping_add(1) as u16; |
1379 | | num[mixed1] = num_ref1.wrapping_add(1) as u16; |
1380 | | num[mixed2] = num_ref2.wrapping_add(1) as u16; |
1381 | | num[mixed3] = num_ref3.wrapping_add(1) as u16; |
1382 | | num_ref0 &= self.specialization.block_mask(); |
1383 | | num_ref1 &= self.specialization.block_mask(); |
1384 | | num_ref2 &= self.specialization.block_mask(); |
1385 | | num_ref3 &= self.specialization.block_mask(); |
1386 | | let offset0: usize = |
1387 | | (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; |
1388 | | let offset1: usize = |
1389 | | (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; |
1390 | | let offset2: usize = |
1391 | | (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; |
1392 | | let offset3: usize = |
1393 | | (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; |
1394 | | buckets[offset0] = (ix_offset + i) as u32; |
1395 | | buckets[offset1] = (ix_offset + i + 1) as u32; |
1396 | | buckets[offset2] = (ix_offset + i + 2) as u32; |
1397 | | buckets[offset3] = (ix_offset + i + 3) as u32; |
1398 | | } |
1399 | | } |
1400 | | return ix_start + del * REG_SIZE; |
1401 | | } |
1402 | | ix_start |
1403 | | } |
1404 | | |
1405 | | #[cfg(feature = "benchmark")] |
1406 | | fn BulkStoreRangeOptRandomDupeUpdate( |
1407 | | &mut self, |
1408 | | data: &[u8], |
1409 | | mask: usize, |
1410 | | ix_start: usize, |
1411 | | ix_end: usize, |
1412 | | ) -> usize { |
1413 | | const REG_SIZE: usize = 32usize; |
1414 | | let lookahead = self.specialization.StoreLookahead(); |
1415 | | if mask == usize::MAX && ix_end > ix_start + REG_SIZE && lookahead == 4 { |
1416 | | const lookahead4: usize = 4; |
1417 | | assert_eq!(lookahead4, lookahead); |
1418 | | let mut data64 = [0u8; REG_SIZE + lookahead4]; |
1419 | | let del = (ix_end - ix_start) / REG_SIZE; |
1420 | | let num = self.num.slice_mut(); |
1421 | | let buckets = self.buckets.slice_mut(); |
1422 | | assert_eq!(num.len(), self.specialization.bucket_size() as usize); |
1423 | | assert_eq!( |
1424 | | buckets.len(), |
1425 | | self.specialization.bucket_size() as usize |
1426 | | * self.specialization.block_size() as usize |
1427 | | ); |
1428 | | let shift = self.specialization.hash_shift(); |
1429 | | for chunk_id in 0..del { |
1430 | | let ix_offset = ix_start + chunk_id * REG_SIZE; |
1431 | | data64[..REG_SIZE + lookahead4] |
1432 | | .clone_from_slice(data.split_at(ix_offset).1.split_at(REG_SIZE + lookahead4).0); |
1433 | | for i in 0..REG_SIZE { |
1434 | | let mixed_word = ((u32::from(data64[i]) |
1435 | | | (u32::from(data64[i + 1]) << 8) |
1436 | | | (u32::from(data64[i + 2]) << 16) |
1437 | | | (u32::from(data64[i + 3]) << 24)) |
1438 | | as u64 |
1439 | | * self.specialization.get_k_hash_mul()) |
1440 | | & self.specialization.get_hash_mask(); |
1441 | | let key = mixed_word >> shift; |
1442 | | let minor_ix: usize = chunk_id & self.specialization.block_mask() as usize; // *num_ref as usize & self.specialization.block_mask() as usize; //GIGANTIC HAX: overwrite firsst option |
1443 | | let offset: usize = |
1444 | | minor_ix + (key << self.specialization.block_bits()) as usize; |
1445 | | buckets[offset] = (ix_offset + i) as u32; |
1446 | | } |
1447 | | } |
1448 | | for (bucket_index, num_ref) in num.iter_mut().enumerate() { |
1449 | | let region = buckets |
1450 | | .split_at_mut(bucket_index << self.specialization.block_bits()) |
1451 | | .1 |
1452 | | .split_at_mut(self.specialization.block_size() as usize) |
1453 | | .0; |
1454 | | let mut lnum = 0usize; |
1455 | | for block_index in 0..self.specialization.block_size() as usize { |
1456 | | if region[block_index] != 0 { |
1457 | | let byte_addr = region[block_index]; |
1458 | | region[lnum] = byte_addr; |
1459 | | lnum += 1; |
1460 | | } |
1461 | | } |
1462 | | *num_ref = lnum as u16; |
1463 | | } |
1464 | | return ix_start + del * REG_SIZE; |
1465 | | } |
1466 | | ix_start |
1467 | | } |
1468 | | } |
1469 | | |
1470 | | impl< |
1471 | | Specialization: AdvHashSpecialization + Clone, |
1472 | | Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>, |
1473 | | > AnyHasher for AdvHasher<Specialization, Alloc> |
1474 | | { |
1475 | 8.23M | fn Opts(&self) -> H9Opts { |
1476 | 8.23M | self.h9_opts |
1477 | 8.23M | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 1475 | 890k | fn Opts(&self) -> H9Opts { | 1476 | 890k | self.h9_opts | 1477 | 890k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 1475 | 6.34M | fn Opts(&self) -> H9Opts { | 1476 | 6.34M | self.h9_opts | 1477 | 6.34M | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 1475 | 607k | fn Opts(&self) -> H9Opts { | 1476 | 607k | self.h9_opts | 1477 | 607k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Opts Line | Count | Source | 1475 | 390k | fn Opts(&self) -> H9Opts { | 1476 | 390k | self.h9_opts | 1477 | 390k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::Opts |
1478 | 521k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { |
1479 | 521k | let num_distances = self.GetHasherCommon.params.num_last_distances_to_check; |
1480 | 521k | adv_prepare_distance_cache(distance_cache, num_distances); |
1481 | 521k | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 1478 | 80.2k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { | 1479 | 80.2k | let num_distances = self.GetHasherCommon.params.num_last_distances_to_check; | 1480 | 80.2k | adv_prepare_distance_cache(distance_cache, num_distances); | 1481 | 80.2k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 1478 | 346k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { | 1479 | 346k | let num_distances = self.GetHasherCommon.params.num_last_distances_to_check; | 1480 | 346k | adv_prepare_distance_cache(distance_cache, num_distances); | 1481 | 346k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 1478 | 61.9k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { | 1479 | 61.9k | let num_distances = self.GetHasherCommon.params.num_last_distances_to_check; | 1480 | 61.9k | adv_prepare_distance_cache(distance_cache, num_distances); | 1481 | 61.9k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache Line | Count | Source | 1478 | 33.5k | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { | 1479 | 33.5k | let num_distances = self.GetHasherCommon.params.num_last_distances_to_check; | 1480 | 33.5k | adv_prepare_distance_cache(distance_cache, num_distances); | 1481 | 33.5k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::PrepareDistanceCache |
1482 | 3.16k | fn StitchToPreviousBlock( |
1483 | 3.16k | &mut self, |
1484 | 3.16k | num_bytes: usize, |
1485 | 3.16k | position: usize, |
1486 | 3.16k | ringbuffer: &[u8], |
1487 | 3.16k | ringbuffer_mask: usize, |
1488 | 3.16k | ) { |
1489 | 3.16k | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); |
1490 | 3.16k | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 1482 | 740 | fn StitchToPreviousBlock( | 1483 | 740 | &mut self, | 1484 | 740 | num_bytes: usize, | 1485 | 740 | position: usize, | 1486 | 740 | ringbuffer: &[u8], | 1487 | 740 | ringbuffer_mask: usize, | 1488 | 740 | ) { | 1489 | 740 | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); | 1490 | 740 | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 1482 | 1.14k | fn StitchToPreviousBlock( | 1483 | 1.14k | &mut self, | 1484 | 1.14k | num_bytes: usize, | 1485 | 1.14k | position: usize, | 1486 | 1.14k | ringbuffer: &[u8], | 1487 | 1.14k | ringbuffer_mask: usize, | 1488 | 1.14k | ) { | 1489 | 1.14k | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); | 1490 | 1.14k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 1482 | 698 | fn StitchToPreviousBlock( | 1483 | 698 | &mut self, | 1484 | 698 | num_bytes: usize, | 1485 | 698 | position: usize, | 1486 | 698 | ringbuffer: &[u8], | 1487 | 698 | ringbuffer_mask: usize, | 1488 | 698 | ) { | 1489 | 698 | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); | 1490 | 698 | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 1482 | 588 | fn StitchToPreviousBlock( | 1483 | 588 | &mut self, | 1484 | 588 | num_bytes: usize, | 1485 | 588 | position: usize, | 1486 | 588 | ringbuffer: &[u8], | 1487 | 588 | ringbuffer_mask: usize, | 1488 | 588 | ) { | 1489 | 588 | StitchToPreviousBlockInternal(self, num_bytes, position, ringbuffer, ringbuffer_mask); | 1490 | 588 | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock |
1491 | 521 | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { |
1492 | 521 | if self.GetHasherCommon.is_prepared_ != 0 { |
1493 | 521 | return HowPrepared::ALREADY_PREPARED; |
1494 | 0 | } |
1495 | 0 | let partial_prepare_threshold = self.specialization.bucket_size() as usize >> 6; |
1496 | 0 | if one_shot && input_size <= partial_prepare_threshold { |
1497 | 0 | for i in 0..input_size { |
1498 | 0 | let key = self.HashBytes(&data[i..]); |
1499 | 0 | self.num.slice_mut()[key] = 0; |
1500 | 0 | } |
1501 | | } else { |
1502 | 0 | for item in |
1503 | 0 | self.num.slice_mut()[..(self.specialization.bucket_size() as usize)].iter_mut() |
1504 | 0 | { |
1505 | 0 | *item = 0; |
1506 | 0 | } |
1507 | | } |
1508 | 0 | self.GetHasherCommon.is_prepared_ = 1; |
1509 | 0 | HowPrepared::NEWLY_PREPARED |
1510 | 521 | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 1491 | 94 | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 1492 | 94 | if self.GetHasherCommon.is_prepared_ != 0 { | 1493 | 94 | return HowPrepared::ALREADY_PREPARED; | 1494 | 0 | } | 1495 | 0 | let partial_prepare_threshold = self.specialization.bucket_size() as usize >> 6; | 1496 | 0 | if one_shot && input_size <= partial_prepare_threshold { | 1497 | 0 | for i in 0..input_size { | 1498 | 0 | let key = self.HashBytes(&data[i..]); | 1499 | 0 | self.num.slice_mut()[key] = 0; | 1500 | 0 | } | 1501 | | } else { | 1502 | 0 | for item in | 1503 | 0 | self.num.slice_mut()[..(self.specialization.bucket_size() as usize)].iter_mut() | 1504 | 0 | { | 1505 | 0 | *item = 0; | 1506 | 0 | } | 1507 | | } | 1508 | 0 | self.GetHasherCommon.is_prepared_ = 1; | 1509 | 0 | HowPrepared::NEWLY_PREPARED | 1510 | 94 | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 1491 | 303 | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 1492 | 303 | if self.GetHasherCommon.is_prepared_ != 0 { | 1493 | 303 | return HowPrepared::ALREADY_PREPARED; | 1494 | 0 | } | 1495 | 0 | let partial_prepare_threshold = self.specialization.bucket_size() as usize >> 6; | 1496 | 0 | if one_shot && input_size <= partial_prepare_threshold { | 1497 | 0 | for i in 0..input_size { | 1498 | 0 | let key = self.HashBytes(&data[i..]); | 1499 | 0 | self.num.slice_mut()[key] = 0; | 1500 | 0 | } | 1501 | | } else { | 1502 | 0 | for item in | 1503 | 0 | self.num.slice_mut()[..(self.specialization.bucket_size() as usize)].iter_mut() | 1504 | 0 | { | 1505 | 0 | *item = 0; | 1506 | 0 | } | 1507 | | } | 1508 | 0 | self.GetHasherCommon.is_prepared_ = 1; | 1509 | 0 | HowPrepared::NEWLY_PREPARED | 1510 | 303 | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 1491 | 64 | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 1492 | 64 | if self.GetHasherCommon.is_prepared_ != 0 { | 1493 | 64 | return HowPrepared::ALREADY_PREPARED; | 1494 | 0 | } | 1495 | 0 | let partial_prepare_threshold = self.specialization.bucket_size() as usize >> 6; | 1496 | 0 | if one_shot && input_size <= partial_prepare_threshold { | 1497 | 0 | for i in 0..input_size { | 1498 | 0 | let key = self.HashBytes(&data[i..]); | 1499 | 0 | self.num.slice_mut()[key] = 0; | 1500 | 0 | } | 1501 | | } else { | 1502 | 0 | for item in | 1503 | 0 | self.num.slice_mut()[..(self.specialization.bucket_size() as usize)].iter_mut() | 1504 | 0 | { | 1505 | 0 | *item = 0; | 1506 | 0 | } | 1507 | | } | 1508 | 0 | self.GetHasherCommon.is_prepared_ = 1; | 1509 | 0 | HowPrepared::NEWLY_PREPARED | 1510 | 64 | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 1491 | 60 | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 1492 | 60 | if self.GetHasherCommon.is_prepared_ != 0 { | 1493 | 60 | return HowPrepared::ALREADY_PREPARED; | 1494 | 0 | } | 1495 | 0 | let partial_prepare_threshold = self.specialization.bucket_size() as usize >> 6; | 1496 | 0 | if one_shot && input_size <= partial_prepare_threshold { | 1497 | 0 | for i in 0..input_size { | 1498 | 0 | let key = self.HashBytes(&data[i..]); | 1499 | 0 | self.num.slice_mut()[key] = 0; | 1500 | 0 | } | 1501 | | } else { | 1502 | 0 | for item in | 1503 | 0 | self.num.slice_mut()[..(self.specialization.bucket_size() as usize)].iter_mut() | 1504 | 0 | { | 1505 | 0 | *item = 0; | 1506 | 0 | } | 1507 | | } | 1508 | 0 | self.GetHasherCommon.is_prepared_ = 1; | 1509 | 0 | HowPrepared::NEWLY_PREPARED | 1510 | 60 | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::Prepare |
1511 | | |
1512 | 3.41M | fn GetHasherCommon(&mut self) -> &mut Struct1 { |
1513 | 3.41M | &mut self.GetHasherCommon |
1514 | 3.41M | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 1512 | 342k | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 1513 | 342k | &mut self.GetHasherCommon | 1514 | 342k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 1512 | 2.70M | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 1513 | 2.70M | &mut self.GetHasherCommon | 1514 | 2.70M | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 1512 | 216k | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 1513 | 216k | &mut self.GetHasherCommon | 1514 | 216k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 1512 | 149k | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 1513 | 149k | &mut self.GetHasherCommon | 1514 | 149k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon |
1515 | 4.08M | fn HashTypeLength(&self) -> usize { |
1516 | 4.08M | self.specialization.HashTypeLength() |
1517 | 4.08M | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 1515 | 443k | fn HashTypeLength(&self) -> usize { | 1516 | 443k | self.specialization.HashTypeLength() | 1517 | 443k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 1515 | 3.14M | fn HashTypeLength(&self) -> usize { | 1516 | 3.14M | self.specialization.HashTypeLength() | 1517 | 3.14M | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 1515 | 300k | fn HashTypeLength(&self) -> usize { | 1516 | 300k | self.specialization.HashTypeLength() | 1517 | 300k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashTypeLength Line | Count | Source | 1515 | 197k | fn HashTypeLength(&self) -> usize { | 1516 | 197k | self.specialization.HashTypeLength() | 1517 | 197k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::HashTypeLength |
1518 | 481k | fn StoreLookahead(&self) -> usize { |
1519 | 481k | self.specialization.StoreLookahead() |
1520 | 481k | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 1518 | 37.0k | fn StoreLookahead(&self) -> usize { | 1519 | 37.0k | self.specialization.StoreLookahead() | 1520 | 37.0k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 1518 | 395k | fn StoreLookahead(&self) -> usize { | 1519 | 395k | self.specialization.StoreLookahead() | 1520 | 395k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 1518 | 26.8k | fn StoreLookahead(&self) -> usize { | 1519 | 26.8k | self.specialization.StoreLookahead() | 1520 | 26.8k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreLookahead Line | Count | Source | 1518 | 22.1k | fn StoreLookahead(&self) -> usize { | 1519 | 22.1k | self.specialization.StoreLookahead() | 1520 | 22.1k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::StoreLookahead |
1521 | 21.8M | fn HashBytes(&self, data: &[u8]) -> usize { |
1522 | 21.8M | let shift = self.specialization.hash_shift(); |
1523 | 21.8M | let h: u64 = self.specialization.load_and_mix_word(data); |
1524 | 21.8M | (h >> shift) as u32 as usize |
1525 | 21.8M | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 1521 | 825k | fn HashBytes(&self, data: &[u8]) -> usize { | 1522 | 825k | let shift = self.specialization.hash_shift(); | 1523 | 825k | let h: u64 = self.specialization.load_and_mix_word(data); | 1524 | 825k | (h >> shift) as u32 as usize | 1525 | 825k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 1521 | 20.0M | fn HashBytes(&self, data: &[u8]) -> usize { | 1522 | 20.0M | let shift = self.specialization.hash_shift(); | 1523 | 20.0M | let h: u64 = self.specialization.load_and_mix_word(data); | 1524 | 20.0M | (h >> shift) as u32 as usize | 1525 | 20.0M | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 1521 | 632k | fn HashBytes(&self, data: &[u8]) -> usize { | 1522 | 632k | let shift = self.specialization.hash_shift(); | 1523 | 632k | let h: u64 = self.specialization.load_and_mix_word(data); | 1524 | 632k | (h >> shift) as u32 as usize | 1525 | 632k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::HashBytes Line | Count | Source | 1521 | 368k | fn HashBytes(&self, data: &[u8]) -> usize { | 1522 | 368k | let shift = self.specialization.hash_shift(); | 1523 | 368k | let h: u64 = self.specialization.load_and_mix_word(data); | 1524 | 368k | (h >> shift) as u32 as usize | 1525 | 368k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::HashBytes |
1526 | 145k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { |
1527 | 145k | if self.specialization.StoreLookahead() != 4 { |
1528 | 619k | for i in 0..4 { |
1529 | 495k | self.Store(data, mask, ix + i * 2); |
1530 | 495k | } |
1531 | 123k | return; |
1532 | 21.7k | } |
1533 | 21.7k | let shift = self.specialization.hash_shift(); |
1534 | 21.7k | let num = self.num.slice_mut(); |
1535 | 21.7k | let buckets = self.buckets.slice_mut(); |
1536 | 21.7k | let li = ix & mask; |
1537 | 21.7k | let lword = u64::from(data[li]) |
1538 | 21.7k | | (u64::from(data[li + 1]) << 8) |
1539 | 21.7k | | (u64::from(data[li + 2]) << 16) |
1540 | 21.7k | | (u64::from(data[li + 3]) << 24) |
1541 | 21.7k | | (u64::from(data[li + 4]) << 32) |
1542 | 21.7k | | (u64::from(data[li + 5]) << 40) |
1543 | 21.7k | | (u64::from(data[li + 6]) << 48) |
1544 | 21.7k | | (u64::from(data[li + 7]) << 56); |
1545 | 21.7k | let hi = (ix + 8) & mask; |
1546 | 21.7k | let hword = u64::from(data[hi]) | (u64::from(data[hi + 1]) << 8); |
1547 | 21.7k | let mixed0 = ((((lword & 0xffff_ffff) * self.specialization.get_k_hash_mul()) |
1548 | 21.7k | & self.specialization.get_hash_mask()) |
1549 | 21.7k | >> shift) as usize; |
1550 | 21.7k | let mixed1 = (((((lword >> 16) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) |
1551 | 21.7k | & self.specialization.get_hash_mask()) |
1552 | 21.7k | >> shift) as usize; |
1553 | 21.7k | let mixed2 = (((((lword >> 32) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) |
1554 | 21.7k | & self.specialization.get_hash_mask()) |
1555 | 21.7k | >> shift) as usize; |
1556 | 21.7k | let mixed3 = ((((((hword & 0xffff) << 16) | ((lword >> 48) & 0xffff)) |
1557 | 21.7k | * self.specialization.get_k_hash_mul()) |
1558 | 21.7k | & self.specialization.get_hash_mask()) |
1559 | 21.7k | >> shift) as usize; |
1560 | 21.7k | let mut num_ref0 = u32::from(num[mixed0]); |
1561 | 21.7k | num[mixed0] = num_ref0.wrapping_add(1) as u16; |
1562 | 21.7k | num_ref0 &= self.specialization.block_mask(); |
1563 | 21.7k | let mut num_ref1 = u32::from(num[mixed1]); |
1564 | 21.7k | num[mixed1] = num_ref1.wrapping_add(1) as u16; |
1565 | 21.7k | num_ref1 &= self.specialization.block_mask(); |
1566 | 21.7k | let mut num_ref2 = u32::from(num[mixed2]); |
1567 | 21.7k | num[mixed2] = num_ref2.wrapping_add(1) as u16; |
1568 | 21.7k | num_ref2 &= self.specialization.block_mask(); |
1569 | 21.7k | let mut num_ref3 = u32::from(num[mixed3]); |
1570 | 21.7k | num[mixed3] = num_ref3.wrapping_add(1) as u16; |
1571 | 21.7k | num_ref3 &= self.specialization.block_mask(); |
1572 | 21.7k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; |
1573 | 21.7k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; |
1574 | 21.7k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; |
1575 | 21.7k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; |
1576 | 21.7k | buckets[offset0] = ix as u32; |
1577 | 21.7k | buckets[offset1] = (ix + 2) as u32; |
1578 | 21.7k | buckets[offset2] = (ix + 4) as u32; |
1579 | 21.7k | buckets[offset3] = (ix + 6) as u32; |
1580 | 145k | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 1526 | 7.47k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1527 | 7.47k | if self.specialization.StoreLookahead() != 4 { | 1528 | 0 | for i in 0..4 { | 1529 | 0 | self.Store(data, mask, ix + i * 2); | 1530 | 0 | } | 1531 | 0 | return; | 1532 | 7.47k | } | 1533 | 7.47k | let shift = self.specialization.hash_shift(); | 1534 | 7.47k | let num = self.num.slice_mut(); | 1535 | 7.47k | let buckets = self.buckets.slice_mut(); | 1536 | 7.47k | let li = ix & mask; | 1537 | 7.47k | let lword = u64::from(data[li]) | 1538 | 7.47k | | (u64::from(data[li + 1]) << 8) | 1539 | 7.47k | | (u64::from(data[li + 2]) << 16) | 1540 | 7.47k | | (u64::from(data[li + 3]) << 24) | 1541 | 7.47k | | (u64::from(data[li + 4]) << 32) | 1542 | 7.47k | | (u64::from(data[li + 5]) << 40) | 1543 | 7.47k | | (u64::from(data[li + 6]) << 48) | 1544 | 7.47k | | (u64::from(data[li + 7]) << 56); | 1545 | 7.47k | let hi = (ix + 8) & mask; | 1546 | 7.47k | let hword = u64::from(data[hi]) | (u64::from(data[hi + 1]) << 8); | 1547 | 7.47k | let mixed0 = ((((lword & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1548 | 7.47k | & self.specialization.get_hash_mask()) | 1549 | 7.47k | >> shift) as usize; | 1550 | 7.47k | let mixed1 = (((((lword >> 16) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1551 | 7.47k | & self.specialization.get_hash_mask()) | 1552 | 7.47k | >> shift) as usize; | 1553 | 7.47k | let mixed2 = (((((lword >> 32) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1554 | 7.47k | & self.specialization.get_hash_mask()) | 1555 | 7.47k | >> shift) as usize; | 1556 | 7.47k | let mixed3 = ((((((hword & 0xffff) << 16) | ((lword >> 48) & 0xffff)) | 1557 | 7.47k | * self.specialization.get_k_hash_mul()) | 1558 | 7.47k | & self.specialization.get_hash_mask()) | 1559 | 7.47k | >> shift) as usize; | 1560 | 7.47k | let mut num_ref0 = u32::from(num[mixed0]); | 1561 | 7.47k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1562 | 7.47k | num_ref0 &= self.specialization.block_mask(); | 1563 | 7.47k | let mut num_ref1 = u32::from(num[mixed1]); | 1564 | 7.47k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1565 | 7.47k | num_ref1 &= self.specialization.block_mask(); | 1566 | 7.47k | let mut num_ref2 = u32::from(num[mixed2]); | 1567 | 7.47k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1568 | 7.47k | num_ref2 &= self.specialization.block_mask(); | 1569 | 7.47k | let mut num_ref3 = u32::from(num[mixed3]); | 1570 | 7.47k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1571 | 7.47k | num_ref3 &= self.specialization.block_mask(); | 1572 | 7.47k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1573 | 7.47k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1574 | 7.47k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1575 | 7.47k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1576 | 7.47k | buckets[offset0] = ix as u32; | 1577 | 7.47k | buckets[offset1] = (ix + 2) as u32; | 1578 | 7.47k | buckets[offset2] = (ix + 4) as u32; | 1579 | 7.47k | buckets[offset3] = (ix + 6) as u32; | 1580 | 7.47k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 1526 | 123k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1527 | 123k | if self.specialization.StoreLookahead() != 4 { | 1528 | 619k | for i in 0..4 { | 1529 | 495k | self.Store(data, mask, ix + i * 2); | 1530 | 495k | } | 1531 | 123k | return; | 1532 | 0 | } | 1533 | 0 | let shift = self.specialization.hash_shift(); | 1534 | 0 | let num = self.num.slice_mut(); | 1535 | 0 | let buckets = self.buckets.slice_mut(); | 1536 | 0 | let li = ix & mask; | 1537 | 0 | let lword = u64::from(data[li]) | 1538 | 0 | | (u64::from(data[li + 1]) << 8) | 1539 | 0 | | (u64::from(data[li + 2]) << 16) | 1540 | 0 | | (u64::from(data[li + 3]) << 24) | 1541 | 0 | | (u64::from(data[li + 4]) << 32) | 1542 | 0 | | (u64::from(data[li + 5]) << 40) | 1543 | 0 | | (u64::from(data[li + 6]) << 48) | 1544 | 0 | | (u64::from(data[li + 7]) << 56); | 1545 | 0 | let hi = (ix + 8) & mask; | 1546 | 0 | let hword = u64::from(data[hi]) | (u64::from(data[hi + 1]) << 8); | 1547 | 0 | let mixed0 = ((((lword & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1548 | 0 | & self.specialization.get_hash_mask()) | 1549 | 0 | >> shift) as usize; | 1550 | 0 | let mixed1 = (((((lword >> 16) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1551 | 0 | & self.specialization.get_hash_mask()) | 1552 | 0 | >> shift) as usize; | 1553 | 0 | let mixed2 = (((((lword >> 32) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1554 | 0 | & self.specialization.get_hash_mask()) | 1555 | 0 | >> shift) as usize; | 1556 | 0 | let mixed3 = ((((((hword & 0xffff) << 16) | ((lword >> 48) & 0xffff)) | 1557 | 0 | * self.specialization.get_k_hash_mul()) | 1558 | 0 | & self.specialization.get_hash_mask()) | 1559 | 0 | >> shift) as usize; | 1560 | 0 | let mut num_ref0 = u32::from(num[mixed0]); | 1561 | 0 | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1562 | 0 | num_ref0 &= self.specialization.block_mask(); | 1563 | 0 | let mut num_ref1 = u32::from(num[mixed1]); | 1564 | 0 | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1565 | 0 | num_ref1 &= self.specialization.block_mask(); | 1566 | 0 | let mut num_ref2 = u32::from(num[mixed2]); | 1567 | 0 | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1568 | 0 | num_ref2 &= self.specialization.block_mask(); | 1569 | 0 | let mut num_ref3 = u32::from(num[mixed3]); | 1570 | 0 | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1571 | 0 | num_ref3 &= self.specialization.block_mask(); | 1572 | 0 | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1573 | 0 | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1574 | 0 | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1575 | 0 | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1576 | 0 | buckets[offset0] = ix as u32; | 1577 | 0 | buckets[offset1] = (ix + 2) as u32; | 1578 | 0 | buckets[offset2] = (ix + 4) as u32; | 1579 | 0 | buckets[offset3] = (ix + 6) as u32; | 1580 | 123k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 1526 | 8.12k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1527 | 8.12k | if self.specialization.StoreLookahead() != 4 { | 1528 | 0 | for i in 0..4 { | 1529 | 0 | self.Store(data, mask, ix + i * 2); | 1530 | 0 | } | 1531 | 0 | return; | 1532 | 8.12k | } | 1533 | 8.12k | let shift = self.specialization.hash_shift(); | 1534 | 8.12k | let num = self.num.slice_mut(); | 1535 | 8.12k | let buckets = self.buckets.slice_mut(); | 1536 | 8.12k | let li = ix & mask; | 1537 | 8.12k | let lword = u64::from(data[li]) | 1538 | 8.12k | | (u64::from(data[li + 1]) << 8) | 1539 | 8.12k | | (u64::from(data[li + 2]) << 16) | 1540 | 8.12k | | (u64::from(data[li + 3]) << 24) | 1541 | 8.12k | | (u64::from(data[li + 4]) << 32) | 1542 | 8.12k | | (u64::from(data[li + 5]) << 40) | 1543 | 8.12k | | (u64::from(data[li + 6]) << 48) | 1544 | 8.12k | | (u64::from(data[li + 7]) << 56); | 1545 | 8.12k | let hi = (ix + 8) & mask; | 1546 | 8.12k | let hword = u64::from(data[hi]) | (u64::from(data[hi + 1]) << 8); | 1547 | 8.12k | let mixed0 = ((((lword & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1548 | 8.12k | & self.specialization.get_hash_mask()) | 1549 | 8.12k | >> shift) as usize; | 1550 | 8.12k | let mixed1 = (((((lword >> 16) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1551 | 8.12k | & self.specialization.get_hash_mask()) | 1552 | 8.12k | >> shift) as usize; | 1553 | 8.12k | let mixed2 = (((((lword >> 32) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1554 | 8.12k | & self.specialization.get_hash_mask()) | 1555 | 8.12k | >> shift) as usize; | 1556 | 8.12k | let mixed3 = ((((((hword & 0xffff) << 16) | ((lword >> 48) & 0xffff)) | 1557 | 8.12k | * self.specialization.get_k_hash_mul()) | 1558 | 8.12k | & self.specialization.get_hash_mask()) | 1559 | 8.12k | >> shift) as usize; | 1560 | 8.12k | let mut num_ref0 = u32::from(num[mixed0]); | 1561 | 8.12k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1562 | 8.12k | num_ref0 &= self.specialization.block_mask(); | 1563 | 8.12k | let mut num_ref1 = u32::from(num[mixed1]); | 1564 | 8.12k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1565 | 8.12k | num_ref1 &= self.specialization.block_mask(); | 1566 | 8.12k | let mut num_ref2 = u32::from(num[mixed2]); | 1567 | 8.12k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1568 | 8.12k | num_ref2 &= self.specialization.block_mask(); | 1569 | 8.12k | let mut num_ref3 = u32::from(num[mixed3]); | 1570 | 8.12k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1571 | 8.12k | num_ref3 &= self.specialization.block_mask(); | 1572 | 8.12k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1573 | 8.12k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1574 | 8.12k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1575 | 8.12k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1576 | 8.12k | buckets[offset0] = ix as u32; | 1577 | 8.12k | buckets[offset1] = (ix + 2) as u32; | 1578 | 8.12k | buckets[offset2] = (ix + 4) as u32; | 1579 | 8.12k | buckets[offset3] = (ix + 6) as u32; | 1580 | 8.12k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 Line | Count | Source | 1526 | 6.09k | fn StoreEvenVec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1527 | 6.09k | if self.specialization.StoreLookahead() != 4 { | 1528 | 0 | for i in 0..4 { | 1529 | 0 | self.Store(data, mask, ix + i * 2); | 1530 | 0 | } | 1531 | 0 | return; | 1532 | 6.09k | } | 1533 | 6.09k | let shift = self.specialization.hash_shift(); | 1534 | 6.09k | let num = self.num.slice_mut(); | 1535 | 6.09k | let buckets = self.buckets.slice_mut(); | 1536 | 6.09k | let li = ix & mask; | 1537 | 6.09k | let lword = u64::from(data[li]) | 1538 | 6.09k | | (u64::from(data[li + 1]) << 8) | 1539 | 6.09k | | (u64::from(data[li + 2]) << 16) | 1540 | 6.09k | | (u64::from(data[li + 3]) << 24) | 1541 | 6.09k | | (u64::from(data[li + 4]) << 32) | 1542 | 6.09k | | (u64::from(data[li + 5]) << 40) | 1543 | 6.09k | | (u64::from(data[li + 6]) << 48) | 1544 | 6.09k | | (u64::from(data[li + 7]) << 56); | 1545 | 6.09k | let hi = (ix + 8) & mask; | 1546 | 6.09k | let hword = u64::from(data[hi]) | (u64::from(data[hi + 1]) << 8); | 1547 | 6.09k | let mixed0 = ((((lword & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1548 | 6.09k | & self.specialization.get_hash_mask()) | 1549 | 6.09k | >> shift) as usize; | 1550 | 6.09k | let mixed1 = (((((lword >> 16) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1551 | 6.09k | & self.specialization.get_hash_mask()) | 1552 | 6.09k | >> shift) as usize; | 1553 | 6.09k | let mixed2 = (((((lword >> 32) & 0xffff_ffff) * self.specialization.get_k_hash_mul()) | 1554 | 6.09k | & self.specialization.get_hash_mask()) | 1555 | 6.09k | >> shift) as usize; | 1556 | 6.09k | let mixed3 = ((((((hword & 0xffff) << 16) | ((lword >> 48) & 0xffff)) | 1557 | 6.09k | * self.specialization.get_k_hash_mul()) | 1558 | 6.09k | & self.specialization.get_hash_mask()) | 1559 | 6.09k | >> shift) as usize; | 1560 | 6.09k | let mut num_ref0 = u32::from(num[mixed0]); | 1561 | 6.09k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1562 | 6.09k | num_ref0 &= self.specialization.block_mask(); | 1563 | 6.09k | let mut num_ref1 = u32::from(num[mixed1]); | 1564 | 6.09k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1565 | 6.09k | num_ref1 &= self.specialization.block_mask(); | 1566 | 6.09k | let mut num_ref2 = u32::from(num[mixed2]); | 1567 | 6.09k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1568 | 6.09k | num_ref2 &= self.specialization.block_mask(); | 1569 | 6.09k | let mut num_ref3 = u32::from(num[mixed3]); | 1570 | 6.09k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1571 | 6.09k | num_ref3 &= self.specialization.block_mask(); | 1572 | 6.09k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1573 | 6.09k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1574 | 6.09k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1575 | 6.09k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1576 | 6.09k | buckets[offset0] = ix as u32; | 1577 | 6.09k | buckets[offset1] = (ix + 2) as u32; | 1578 | 6.09k | buckets[offset2] = (ix + 4) as u32; | 1579 | 6.09k | buckets[offset3] = (ix + 6) as u32; | 1580 | 6.09k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::StoreEvenVec4 |
1581 | 329k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { |
1582 | 329k | if self.specialization.StoreLookahead() != 4 { |
1583 | 1.34M | for i in 0..4 { |
1584 | 1.07M | self.Store(data, mask, ix + i * 4); |
1585 | 1.07M | } |
1586 | 269k | return; |
1587 | 60.2k | } |
1588 | 60.2k | let shift = self.specialization.hash_shift(); |
1589 | 60.2k | let num = self.num.slice_mut(); |
1590 | 60.2k | let buckets = self.buckets.slice_mut(); |
1591 | 60.2k | let li = ix & mask; |
1592 | 60.2k | let llword = u32::from(data[li]) |
1593 | 60.2k | | (u32::from(data[li + 1]) << 8) |
1594 | 60.2k | | (u32::from(data[li + 2]) << 16) |
1595 | 60.2k | | (u32::from(data[li + 3]) << 24); |
1596 | 60.2k | let luword = u32::from(data[li + 4]) |
1597 | 60.2k | | (u32::from(data[li + 5]) << 8) |
1598 | 60.2k | | (u32::from(data[li + 6]) << 16) |
1599 | 60.2k | | (u32::from(data[li + 7]) << 24); |
1600 | 60.2k | let ui = (ix + 8) & mask; |
1601 | 60.2k | let ulword = u32::from(data[ui]) |
1602 | 60.2k | | (u32::from(data[ui + 1]) << 8) |
1603 | 60.2k | | (u32::from(data[ui + 2]) << 16) |
1604 | 60.2k | | (u32::from(data[ui + 3]) << 24); |
1605 | | |
1606 | 60.2k | let uuword = u32::from(data[ui + 4]) |
1607 | 60.2k | | (u32::from(data[ui + 5]) << 8) |
1608 | 60.2k | | (u32::from(data[ui + 6]) << 16) |
1609 | 60.2k | | (u32::from(data[ui + 7]) << 24); |
1610 | | |
1611 | 60.2k | let mixed0 = (((u64::from(llword) * self.specialization.get_k_hash_mul()) |
1612 | 60.2k | & self.specialization.get_hash_mask()) |
1613 | 60.2k | >> shift) as usize; |
1614 | 60.2k | let mixed1 = (((u64::from(luword) * self.specialization.get_k_hash_mul()) |
1615 | 60.2k | & self.specialization.get_hash_mask()) |
1616 | 60.2k | >> shift) as usize; |
1617 | 60.2k | let mixed2 = (((u64::from(ulword) * self.specialization.get_k_hash_mul()) |
1618 | 60.2k | & self.specialization.get_hash_mask()) |
1619 | 60.2k | >> shift) as usize; |
1620 | 60.2k | let mixed3 = (((u64::from(uuword) * self.specialization.get_k_hash_mul()) |
1621 | 60.2k | & self.specialization.get_hash_mask()) |
1622 | 60.2k | >> shift) as usize; |
1623 | 60.2k | let mut num_ref0 = u32::from(num[mixed0]); |
1624 | 60.2k | num[mixed0] = num_ref0.wrapping_add(1) as u16; |
1625 | 60.2k | num_ref0 &= self.specialization.block_mask(); |
1626 | 60.2k | let mut num_ref1 = u32::from(num[mixed1]); |
1627 | 60.2k | num[mixed1] = num_ref1.wrapping_add(1) as u16; |
1628 | 60.2k | num_ref1 &= self.specialization.block_mask(); |
1629 | 60.2k | let mut num_ref2 = u32::from(num[mixed2]); |
1630 | 60.2k | num[mixed2] = num_ref2.wrapping_add(1) as u16; |
1631 | 60.2k | num_ref2 &= self.specialization.block_mask(); |
1632 | 60.2k | let mut num_ref3 = u32::from(num[mixed3]); |
1633 | 60.2k | num[mixed3] = num_ref3.wrapping_add(1) as u16; |
1634 | 60.2k | num_ref3 &= self.specialization.block_mask(); |
1635 | 60.2k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; |
1636 | 60.2k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; |
1637 | 60.2k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; |
1638 | 60.2k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; |
1639 | 60.2k | buckets[offset0] = ix as u32; |
1640 | 60.2k | buckets[offset1] = (ix + 4) as u32; |
1641 | 60.2k | buckets[offset2] = (ix + 8) as u32; |
1642 | 60.2k | buckets[offset3] = (ix + 12) as u32; |
1643 | 329k | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 1581 | 28.1k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1582 | 28.1k | if self.specialization.StoreLookahead() != 4 { | 1583 | 0 | for i in 0..4 { | 1584 | 0 | self.Store(data, mask, ix + i * 4); | 1585 | 0 | } | 1586 | 0 | return; | 1587 | 28.1k | } | 1588 | 28.1k | let shift = self.specialization.hash_shift(); | 1589 | 28.1k | let num = self.num.slice_mut(); | 1590 | 28.1k | let buckets = self.buckets.slice_mut(); | 1591 | 28.1k | let li = ix & mask; | 1592 | 28.1k | let llword = u32::from(data[li]) | 1593 | 28.1k | | (u32::from(data[li + 1]) << 8) | 1594 | 28.1k | | (u32::from(data[li + 2]) << 16) | 1595 | 28.1k | | (u32::from(data[li + 3]) << 24); | 1596 | 28.1k | let luword = u32::from(data[li + 4]) | 1597 | 28.1k | | (u32::from(data[li + 5]) << 8) | 1598 | 28.1k | | (u32::from(data[li + 6]) << 16) | 1599 | 28.1k | | (u32::from(data[li + 7]) << 24); | 1600 | 28.1k | let ui = (ix + 8) & mask; | 1601 | 28.1k | let ulword = u32::from(data[ui]) | 1602 | 28.1k | | (u32::from(data[ui + 1]) << 8) | 1603 | 28.1k | | (u32::from(data[ui + 2]) << 16) | 1604 | 28.1k | | (u32::from(data[ui + 3]) << 24); | 1605 | | | 1606 | 28.1k | let uuword = u32::from(data[ui + 4]) | 1607 | 28.1k | | (u32::from(data[ui + 5]) << 8) | 1608 | 28.1k | | (u32::from(data[ui + 6]) << 16) | 1609 | 28.1k | | (u32::from(data[ui + 7]) << 24); | 1610 | | | 1611 | 28.1k | let mixed0 = (((u64::from(llword) * self.specialization.get_k_hash_mul()) | 1612 | 28.1k | & self.specialization.get_hash_mask()) | 1613 | 28.1k | >> shift) as usize; | 1614 | 28.1k | let mixed1 = (((u64::from(luword) * self.specialization.get_k_hash_mul()) | 1615 | 28.1k | & self.specialization.get_hash_mask()) | 1616 | 28.1k | >> shift) as usize; | 1617 | 28.1k | let mixed2 = (((u64::from(ulword) * self.specialization.get_k_hash_mul()) | 1618 | 28.1k | & self.specialization.get_hash_mask()) | 1619 | 28.1k | >> shift) as usize; | 1620 | 28.1k | let mixed3 = (((u64::from(uuword) * self.specialization.get_k_hash_mul()) | 1621 | 28.1k | & self.specialization.get_hash_mask()) | 1622 | 28.1k | >> shift) as usize; | 1623 | 28.1k | let mut num_ref0 = u32::from(num[mixed0]); | 1624 | 28.1k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1625 | 28.1k | num_ref0 &= self.specialization.block_mask(); | 1626 | 28.1k | let mut num_ref1 = u32::from(num[mixed1]); | 1627 | 28.1k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1628 | 28.1k | num_ref1 &= self.specialization.block_mask(); | 1629 | 28.1k | let mut num_ref2 = u32::from(num[mixed2]); | 1630 | 28.1k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1631 | 28.1k | num_ref2 &= self.specialization.block_mask(); | 1632 | 28.1k | let mut num_ref3 = u32::from(num[mixed3]); | 1633 | 28.1k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1634 | 28.1k | num_ref3 &= self.specialization.block_mask(); | 1635 | 28.1k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1636 | 28.1k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1637 | 28.1k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1638 | 28.1k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1639 | 28.1k | buckets[offset0] = ix as u32; | 1640 | 28.1k | buckets[offset1] = (ix + 4) as u32; | 1641 | 28.1k | buckets[offset2] = (ix + 8) as u32; | 1642 | 28.1k | buckets[offset3] = (ix + 12) as u32; | 1643 | 28.1k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 1581 | 269k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1582 | 269k | if self.specialization.StoreLookahead() != 4 { | 1583 | 1.34M | for i in 0..4 { | 1584 | 1.07M | self.Store(data, mask, ix + i * 4); | 1585 | 1.07M | } | 1586 | 269k | return; | 1587 | 0 | } | 1588 | 0 | let shift = self.specialization.hash_shift(); | 1589 | 0 | let num = self.num.slice_mut(); | 1590 | 0 | let buckets = self.buckets.slice_mut(); | 1591 | 0 | let li = ix & mask; | 1592 | 0 | let llword = u32::from(data[li]) | 1593 | 0 | | (u32::from(data[li + 1]) << 8) | 1594 | 0 | | (u32::from(data[li + 2]) << 16) | 1595 | 0 | | (u32::from(data[li + 3]) << 24); | 1596 | 0 | let luword = u32::from(data[li + 4]) | 1597 | 0 | | (u32::from(data[li + 5]) << 8) | 1598 | 0 | | (u32::from(data[li + 6]) << 16) | 1599 | 0 | | (u32::from(data[li + 7]) << 24); | 1600 | 0 | let ui = (ix + 8) & mask; | 1601 | 0 | let ulword = u32::from(data[ui]) | 1602 | 0 | | (u32::from(data[ui + 1]) << 8) | 1603 | 0 | | (u32::from(data[ui + 2]) << 16) | 1604 | 0 | | (u32::from(data[ui + 3]) << 24); | 1605 | | | 1606 | 0 | let uuword = u32::from(data[ui + 4]) | 1607 | 0 | | (u32::from(data[ui + 5]) << 8) | 1608 | 0 | | (u32::from(data[ui + 6]) << 16) | 1609 | 0 | | (u32::from(data[ui + 7]) << 24); | 1610 | | | 1611 | 0 | let mixed0 = (((u64::from(llword) * self.specialization.get_k_hash_mul()) | 1612 | 0 | & self.specialization.get_hash_mask()) | 1613 | 0 | >> shift) as usize; | 1614 | 0 | let mixed1 = (((u64::from(luword) * self.specialization.get_k_hash_mul()) | 1615 | 0 | & self.specialization.get_hash_mask()) | 1616 | 0 | >> shift) as usize; | 1617 | 0 | let mixed2 = (((u64::from(ulword) * self.specialization.get_k_hash_mul()) | 1618 | 0 | & self.specialization.get_hash_mask()) | 1619 | 0 | >> shift) as usize; | 1620 | 0 | let mixed3 = (((u64::from(uuword) * self.specialization.get_k_hash_mul()) | 1621 | 0 | & self.specialization.get_hash_mask()) | 1622 | 0 | >> shift) as usize; | 1623 | 0 | let mut num_ref0 = u32::from(num[mixed0]); | 1624 | 0 | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1625 | 0 | num_ref0 &= self.specialization.block_mask(); | 1626 | 0 | let mut num_ref1 = u32::from(num[mixed1]); | 1627 | 0 | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1628 | 0 | num_ref1 &= self.specialization.block_mask(); | 1629 | 0 | let mut num_ref2 = u32::from(num[mixed2]); | 1630 | 0 | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1631 | 0 | num_ref2 &= self.specialization.block_mask(); | 1632 | 0 | let mut num_ref3 = u32::from(num[mixed3]); | 1633 | 0 | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1634 | 0 | num_ref3 &= self.specialization.block_mask(); | 1635 | 0 | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1636 | 0 | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1637 | 0 | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1638 | 0 | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1639 | 0 | buckets[offset0] = ix as u32; | 1640 | 0 | buckets[offset1] = (ix + 4) as u32; | 1641 | 0 | buckets[offset2] = (ix + 8) as u32; | 1642 | 0 | buckets[offset3] = (ix + 12) as u32; | 1643 | 269k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 1581 | 17.3k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1582 | 17.3k | if self.specialization.StoreLookahead() != 4 { | 1583 | 0 | for i in 0..4 { | 1584 | 0 | self.Store(data, mask, ix + i * 4); | 1585 | 0 | } | 1586 | 0 | return; | 1587 | 17.3k | } | 1588 | 17.3k | let shift = self.specialization.hash_shift(); | 1589 | 17.3k | let num = self.num.slice_mut(); | 1590 | 17.3k | let buckets = self.buckets.slice_mut(); | 1591 | 17.3k | let li = ix & mask; | 1592 | 17.3k | let llword = u32::from(data[li]) | 1593 | 17.3k | | (u32::from(data[li + 1]) << 8) | 1594 | 17.3k | | (u32::from(data[li + 2]) << 16) | 1595 | 17.3k | | (u32::from(data[li + 3]) << 24); | 1596 | 17.3k | let luword = u32::from(data[li + 4]) | 1597 | 17.3k | | (u32::from(data[li + 5]) << 8) | 1598 | 17.3k | | (u32::from(data[li + 6]) << 16) | 1599 | 17.3k | | (u32::from(data[li + 7]) << 24); | 1600 | 17.3k | let ui = (ix + 8) & mask; | 1601 | 17.3k | let ulword = u32::from(data[ui]) | 1602 | 17.3k | | (u32::from(data[ui + 1]) << 8) | 1603 | 17.3k | | (u32::from(data[ui + 2]) << 16) | 1604 | 17.3k | | (u32::from(data[ui + 3]) << 24); | 1605 | | | 1606 | 17.3k | let uuword = u32::from(data[ui + 4]) | 1607 | 17.3k | | (u32::from(data[ui + 5]) << 8) | 1608 | 17.3k | | (u32::from(data[ui + 6]) << 16) | 1609 | 17.3k | | (u32::from(data[ui + 7]) << 24); | 1610 | | | 1611 | 17.3k | let mixed0 = (((u64::from(llword) * self.specialization.get_k_hash_mul()) | 1612 | 17.3k | & self.specialization.get_hash_mask()) | 1613 | 17.3k | >> shift) as usize; | 1614 | 17.3k | let mixed1 = (((u64::from(luword) * self.specialization.get_k_hash_mul()) | 1615 | 17.3k | & self.specialization.get_hash_mask()) | 1616 | 17.3k | >> shift) as usize; | 1617 | 17.3k | let mixed2 = (((u64::from(ulword) * self.specialization.get_k_hash_mul()) | 1618 | 17.3k | & self.specialization.get_hash_mask()) | 1619 | 17.3k | >> shift) as usize; | 1620 | 17.3k | let mixed3 = (((u64::from(uuword) * self.specialization.get_k_hash_mul()) | 1621 | 17.3k | & self.specialization.get_hash_mask()) | 1622 | 17.3k | >> shift) as usize; | 1623 | 17.3k | let mut num_ref0 = u32::from(num[mixed0]); | 1624 | 17.3k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1625 | 17.3k | num_ref0 &= self.specialization.block_mask(); | 1626 | 17.3k | let mut num_ref1 = u32::from(num[mixed1]); | 1627 | 17.3k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1628 | 17.3k | num_ref1 &= self.specialization.block_mask(); | 1629 | 17.3k | let mut num_ref2 = u32::from(num[mixed2]); | 1630 | 17.3k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1631 | 17.3k | num_ref2 &= self.specialization.block_mask(); | 1632 | 17.3k | let mut num_ref3 = u32::from(num[mixed3]); | 1633 | 17.3k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1634 | 17.3k | num_ref3 &= self.specialization.block_mask(); | 1635 | 17.3k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1636 | 17.3k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1637 | 17.3k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1638 | 17.3k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1639 | 17.3k | buckets[offset0] = ix as u32; | 1640 | 17.3k | buckets[offset1] = (ix + 4) as u32; | 1641 | 17.3k | buckets[offset2] = (ix + 8) as u32; | 1642 | 17.3k | buckets[offset3] = (ix + 12) as u32; | 1643 | 17.3k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 Line | Count | Source | 1581 | 14.8k | fn Store4Vec4(&mut self, data: &[u8], mask: usize, ix: usize) { | 1582 | 14.8k | if self.specialization.StoreLookahead() != 4 { | 1583 | 0 | for i in 0..4 { | 1584 | 0 | self.Store(data, mask, ix + i * 4); | 1585 | 0 | } | 1586 | 0 | return; | 1587 | 14.8k | } | 1588 | 14.8k | let shift = self.specialization.hash_shift(); | 1589 | 14.8k | let num = self.num.slice_mut(); | 1590 | 14.8k | let buckets = self.buckets.slice_mut(); | 1591 | 14.8k | let li = ix & mask; | 1592 | 14.8k | let llword = u32::from(data[li]) | 1593 | 14.8k | | (u32::from(data[li + 1]) << 8) | 1594 | 14.8k | | (u32::from(data[li + 2]) << 16) | 1595 | 14.8k | | (u32::from(data[li + 3]) << 24); | 1596 | 14.8k | let luword = u32::from(data[li + 4]) | 1597 | 14.8k | | (u32::from(data[li + 5]) << 8) | 1598 | 14.8k | | (u32::from(data[li + 6]) << 16) | 1599 | 14.8k | | (u32::from(data[li + 7]) << 24); | 1600 | 14.8k | let ui = (ix + 8) & mask; | 1601 | 14.8k | let ulword = u32::from(data[ui]) | 1602 | 14.8k | | (u32::from(data[ui + 1]) << 8) | 1603 | 14.8k | | (u32::from(data[ui + 2]) << 16) | 1604 | 14.8k | | (u32::from(data[ui + 3]) << 24); | 1605 | | | 1606 | 14.8k | let uuword = u32::from(data[ui + 4]) | 1607 | 14.8k | | (u32::from(data[ui + 5]) << 8) | 1608 | 14.8k | | (u32::from(data[ui + 6]) << 16) | 1609 | 14.8k | | (u32::from(data[ui + 7]) << 24); | 1610 | | | 1611 | 14.8k | let mixed0 = (((u64::from(llword) * self.specialization.get_k_hash_mul()) | 1612 | 14.8k | & self.specialization.get_hash_mask()) | 1613 | 14.8k | >> shift) as usize; | 1614 | 14.8k | let mixed1 = (((u64::from(luword) * self.specialization.get_k_hash_mul()) | 1615 | 14.8k | & self.specialization.get_hash_mask()) | 1616 | 14.8k | >> shift) as usize; | 1617 | 14.8k | let mixed2 = (((u64::from(ulword) * self.specialization.get_k_hash_mul()) | 1618 | 14.8k | & self.specialization.get_hash_mask()) | 1619 | 14.8k | >> shift) as usize; | 1620 | 14.8k | let mixed3 = (((u64::from(uuword) * self.specialization.get_k_hash_mul()) | 1621 | 14.8k | & self.specialization.get_hash_mask()) | 1622 | 14.8k | >> shift) as usize; | 1623 | 14.8k | let mut num_ref0 = u32::from(num[mixed0]); | 1624 | 14.8k | num[mixed0] = num_ref0.wrapping_add(1) as u16; | 1625 | 14.8k | num_ref0 &= self.specialization.block_mask(); | 1626 | 14.8k | let mut num_ref1 = u32::from(num[mixed1]); | 1627 | 14.8k | num[mixed1] = num_ref1.wrapping_add(1) as u16; | 1628 | 14.8k | num_ref1 &= self.specialization.block_mask(); | 1629 | 14.8k | let mut num_ref2 = u32::from(num[mixed2]); | 1630 | 14.8k | num[mixed2] = num_ref2.wrapping_add(1) as u16; | 1631 | 14.8k | num_ref2 &= self.specialization.block_mask(); | 1632 | 14.8k | let mut num_ref3 = u32::from(num[mixed3]); | 1633 | 14.8k | num[mixed3] = num_ref3.wrapping_add(1) as u16; | 1634 | 14.8k | num_ref3 &= self.specialization.block_mask(); | 1635 | 14.8k | let offset0: usize = (mixed0 << self.specialization.block_bits()) + num_ref0 as usize; | 1636 | 14.8k | let offset1: usize = (mixed1 << self.specialization.block_bits()) + num_ref1 as usize; | 1637 | 14.8k | let offset2: usize = (mixed2 << self.specialization.block_bits()) + num_ref2 as usize; | 1638 | 14.8k | let offset3: usize = (mixed3 << self.specialization.block_bits()) + num_ref3 as usize; | 1639 | 14.8k | buckets[offset0] = ix as u32; | 1640 | 14.8k | buckets[offset1] = (ix + 4) as u32; | 1641 | 14.8k | buckets[offset2] = (ix + 8) as u32; | 1642 | 14.8k | buckets[offset3] = (ix + 12) as u32; | 1643 | 14.8k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::Store4Vec4 |
1644 | 17.0M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { |
1645 | 17.0M | let (_, data_window) = data.split_at((ix & mask)); |
1646 | 17.0M | let key: u32 = self.HashBytes(data_window) as u32; |
1647 | 17.0M | let minor_ix: usize = |
1648 | 17.0M | (self.num.slice()[(key as usize)] as u32 & self.specialization.block_mask()) as usize; |
1649 | 17.0M | let offset: usize = |
1650 | 17.0M | minor_ix.wrapping_add((key << self.specialization.block_bits()) as usize); |
1651 | 17.0M | self.buckets.slice_mut()[offset] = ix as u32; |
1652 | 17.0M | { |
1653 | 17.0M | let _lhs = &mut self.num.slice_mut()[(key as usize)]; |
1654 | 17.0M | *_lhs = (*_lhs as i32 + 1) as u16; |
1655 | 17.0M | } |
1656 | 17.0M | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 1644 | 275k | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 1645 | 275k | let (_, data_window) = data.split_at((ix & mask)); | 1646 | 275k | let key: u32 = self.HashBytes(data_window) as u32; | 1647 | 275k | let minor_ix: usize = | 1648 | 275k | (self.num.slice()[(key as usize)] as u32 & self.specialization.block_mask()) as usize; | 1649 | 275k | let offset: usize = | 1650 | 275k | minor_ix.wrapping_add((key << self.specialization.block_bits()) as usize); | 1651 | 275k | self.buckets.slice_mut()[offset] = ix as u32; | 1652 | 275k | { | 1653 | 275k | let _lhs = &mut self.num.slice_mut()[(key as usize)]; | 1654 | 275k | *_lhs = (*_lhs as i32 + 1) as u16; | 1655 | 275k | } | 1656 | 275k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 1644 | 16.4M | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 1645 | 16.4M | let (_, data_window) = data.split_at((ix & mask)); | 1646 | 16.4M | let key: u32 = self.HashBytes(data_window) as u32; | 1647 | 16.4M | let minor_ix: usize = | 1648 | 16.4M | (self.num.slice()[(key as usize)] as u32 & self.specialization.block_mask()) as usize; | 1649 | 16.4M | let offset: usize = | 1650 | 16.4M | minor_ix.wrapping_add((key << self.specialization.block_bits()) as usize); | 1651 | 16.4M | self.buckets.slice_mut()[offset] = ix as u32; | 1652 | 16.4M | { | 1653 | 16.4M | let _lhs = &mut self.num.slice_mut()[(key as usize)]; | 1654 | 16.4M | *_lhs = (*_lhs as i32 + 1) as u16; | 1655 | 16.4M | } | 1656 | 16.4M | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 1644 | 239k | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 1645 | 239k | let (_, data_window) = data.split_at((ix & mask)); | 1646 | 239k | let key: u32 = self.HashBytes(data_window) as u32; | 1647 | 239k | let minor_ix: usize = | 1648 | 239k | (self.num.slice()[(key as usize)] as u32 & self.specialization.block_mask()) as usize; | 1649 | 239k | let offset: usize = | 1650 | 239k | minor_ix.wrapping_add((key << self.specialization.block_bits()) as usize); | 1651 | 239k | self.buckets.slice_mut()[offset] = ix as u32; | 1652 | 239k | { | 1653 | 239k | let _lhs = &mut self.num.slice_mut()[(key as usize)]; | 1654 | 239k | *_lhs = (*_lhs as i32 + 1) as u16; | 1655 | 239k | } | 1656 | 239k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Store Line | Count | Source | 1644 | 125k | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { | 1645 | 125k | let (_, data_window) = data.split_at((ix & mask)); | 1646 | 125k | let key: u32 = self.HashBytes(data_window) as u32; | 1647 | 125k | let minor_ix: usize = | 1648 | 125k | (self.num.slice()[(key as usize)] as u32 & self.specialization.block_mask()) as usize; | 1649 | 125k | let offset: usize = | 1650 | 125k | minor_ix.wrapping_add((key << self.specialization.block_bits()) as usize); | 1651 | 125k | self.buckets.slice_mut()[offset] = ix as u32; | 1652 | 125k | { | 1653 | 125k | let _lhs = &mut self.num.slice_mut()[(key as usize)]; | 1654 | 125k | *_lhs = (*_lhs as i32 + 1) as u16; | 1655 | 125k | } | 1656 | 125k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::Store |
1657 | 745k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { |
1658 | 15.4M | for i in self.StoreRangeOptBatch(data, mask, ix_start, ix_end)..ix_end { |
1659 | 15.4M | self.Store(data, mask, i); |
1660 | 15.4M | } |
1661 | 745k | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 1657 | 108k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 1658 | 275k | for i in self.StoreRangeOptBatch(data, mask, ix_start, ix_end)..ix_end { | 1659 | 275k | self.Store(data, mask, i); | 1660 | 275k | } | 1661 | 108k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 1657 | 497k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 1658 | 14.8M | for i in self.StoreRangeOptBatch(data, mask, ix_start, ix_end)..ix_end { | 1659 | 14.8M | self.Store(data, mask, i); | 1660 | 14.8M | } | 1661 | 497k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 1657 | 93.3k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 1658 | 239k | for i in self.StoreRangeOptBatch(data, mask, ix_start, ix_end)..ix_end { | 1659 | 239k | self.Store(data, mask, i); | 1660 | 239k | } | 1661 | 93.3k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StoreRange Line | Count | Source | 1657 | 46.7k | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { | 1658 | 125k | for i in self.StoreRangeOptBatch(data, mask, ix_start, ix_end)..ix_end { | 1659 | 125k | self.Store(data, mask, i); | 1660 | 125k | } | 1661 | 46.7k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::StoreRange |
1662 | 0 | fn BulkStoreRange(&mut self, data: &[u8], mask: usize, mut ix_start: usize, ix_end: usize) { |
1663 | | /* |
1664 | | if ix_start + 4096 < ix_end { |
1665 | | for vec_offset in 0..(ix_end - ix_start - 4096) / 16 { |
1666 | | self.Store4Vec4(data, mask, ix_start + vec_offset * 16); |
1667 | | } |
1668 | | ix_start += 16 * ((ix_end - ix_start - 4096) / 16); |
1669 | | } |
1670 | | if ix_start + 512 < ix_end { |
1671 | | for vec_offset in 0..(ix_end - ix_start - 512) / 8 { |
1672 | | self.StoreEvenVec4(data, mask, ix_start + vec_offset * 8); |
1673 | | //self.StoreRange(data, mask, ix_start + vec_offset * 8, ix_start + (1+ vec_offset) * 8); |
1674 | | } |
1675 | | ix_start += 8 * ((ix_end - ix_start - 512) / 8); |
1676 | | } |
1677 | | */ |
1678 | 0 | ix_start = self.BulkStoreRangeOptMemFetch(data, mask, ix_start, ix_end); |
1679 | 0 | for i in ix_start..ix_end { |
1680 | 0 | self.Store(data, mask, i); |
1681 | 0 | } |
1682 | 0 | } |
1683 | | |
1684 | 4.82M | fn FindLongestMatch( |
1685 | 4.82M | &mut self, |
1686 | 4.82M | dictionary: Option<&BrotliDictionary>, |
1687 | 4.82M | dictionary_hash: &[u16], |
1688 | 4.82M | data: &[u8], |
1689 | 4.82M | ring_buffer_mask: usize, |
1690 | 4.82M | ring_buffer_break: Option<core::num::NonZeroUsize>, |
1691 | 4.82M | distance_cache: &[i32], |
1692 | 4.82M | cur_ix: usize, |
1693 | 4.82M | max_length: usize, |
1694 | 4.82M | max_backward: usize, |
1695 | 4.82M | gap: usize, |
1696 | 4.82M | max_distance: usize, |
1697 | 4.82M | out: &mut HasherSearchResult, |
1698 | 4.82M | ) -> bool { |
1699 | 4.82M | let opts = self.Opts(); |
1700 | 4.82M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; |
1701 | 4.82M | let mut is_match_found = false; |
1702 | 4.82M | let mut best_score: u64 = out.score; |
1703 | 4.82M | let mut best_len: usize = out.len; |
1704 | 4.82M | out.len = 0usize; |
1705 | 4.82M | out.len_x_code = 0usize; |
1706 | 4.82M | let cur_data = data.split_at(cur_ix_masked).1; |
1707 | 66.4M | for i in 0..self.GetHasherCommon.params.num_last_distances_to_check as usize { |
1708 | 66.4M | let backward: usize = distance_cache[i] as usize; |
1709 | 66.4M | let mut prev_ix: usize = cur_ix.wrapping_sub(backward); |
1710 | 66.4M | if prev_ix >= cur_ix || backward > max_backward { |
1711 | 3.18M | continue; |
1712 | 63.2M | } |
1713 | 63.2M | prev_ix &= ring_buffer_mask; |
1714 | 63.2M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask |
1715 | 63.2M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask |
1716 | 63.2M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) |
1717 | | { |
1718 | 57.6M | continue; |
1719 | 5.55M | } |
1720 | 5.55M | let prev_data = data.split_at(prev_ix).1; |
1721 | | |
1722 | 5.55M | let unbroken_len = FindMatchLengthWithLimit(prev_data, cur_data, max_length); |
1723 | 5.55M | if unbroken_len >= 3 || (unbroken_len == 2 && i < 2) { |
1724 | 1.30M | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); |
1725 | 1.30M | let mut score: u64 = BackwardReferenceScoreUsingLastDistance(len, opts); |
1726 | 1.30M | if best_score < score { |
1727 | 1.12M | if i != 0 { |
1728 | 618k | score = score.wrapping_sub(BackwardReferencePenaltyUsingLastDistance(i)); |
1729 | 618k | } |
1730 | 1.12M | if best_score < score { |
1731 | 1.12M | best_score = score; |
1732 | 1.12M | best_len = len; |
1733 | 1.12M | out.len = best_len; |
1734 | 1.12M | out.distance = backward; |
1735 | 1.12M | out.score = best_score; |
1736 | 1.12M | is_match_found = true; |
1737 | 1.12M | } |
1738 | 176k | } |
1739 | 4.25M | } |
1740 | | } |
1741 | | |
1742 | 4.82M | let key: u32 = self.HashBytes(cur_data) as u32; |
1743 | 4.82M | let common_block_bits = self.specialization.block_bits(); |
1744 | 4.82M | let num_ref_mut = &mut self.num.slice_mut()[key as usize]; |
1745 | 4.82M | let num_copy = *num_ref_mut; |
1746 | 4.82M | let bucket: &mut [u32] = self |
1747 | 4.82M | .buckets |
1748 | 4.82M | .slice_mut() |
1749 | 4.82M | .split_at_mut((key << common_block_bits) as usize) |
1750 | 4.82M | .1 |
1751 | 4.82M | .split_at_mut(self.specialization.block_size() as usize) |
1752 | 4.82M | .0; |
1753 | 4.82M | assert!(bucket.len() > self.specialization.block_mask() as usize); |
1754 | 4.82M | if num_copy != 0 { |
1755 | 3.72M | let down: usize = max( |
1756 | 3.72M | i32::from(num_copy) - self.specialization.block_size() as i32, |
1757 | 3.72M | 0, |
1758 | 3.72M | ) as usize; |
1759 | 3.72M | let mut i = num_copy as usize; |
1760 | 55.2M | while i > down { |
1761 | 54.4M | i -= 1; |
1762 | 54.4M | let mut prev_ix = bucket[i & self.specialization.block_mask() as usize] as usize; |
1763 | 54.4M | let backward = cur_ix.wrapping_sub(prev_ix); |
1764 | 54.4M | prev_ix &= ring_buffer_mask; |
1765 | 54.4M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask |
1766 | 54.4M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask |
1767 | 54.3M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) |
1768 | | { |
1769 | 45.5M | if backward > max_backward { |
1770 | 1.19M | break; |
1771 | 44.4M | } |
1772 | 44.4M | continue; |
1773 | 8.84M | } |
1774 | 8.84M | if backward > max_backward { |
1775 | 1.71M | break; |
1776 | 7.13M | } |
1777 | 7.13M | let prev_data = data.split_at(prev_ix).1; |
1778 | 7.13M | let unbroken_len = FindMatchLengthWithLimitMin4(prev_data, cur_data, max_length); |
1779 | 7.13M | if unbroken_len != 0 { |
1780 | 7.09M | let len = |
1781 | 7.09M | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); |
1782 | 7.09M | let score: u64 = BackwardReferenceScore(len, backward, opts); |
1783 | 7.09M | if best_score < score { |
1784 | 1.87M | best_score = score; |
1785 | 1.87M | best_len = len; |
1786 | 1.87M | out.len = best_len; |
1787 | 1.87M | out.distance = backward; |
1788 | 1.87M | out.score = best_score; |
1789 | 1.87M | is_match_found = true; |
1790 | 5.21M | } |
1791 | 33.5k | } |
1792 | | } |
1793 | 1.09M | } |
1794 | 4.82M | bucket[(num_copy as u32 & self.specialization.block_mask()) as usize] = cur_ix as u32; |
1795 | 4.82M | *num_ref_mut = num_ref_mut.wrapping_add(1); |
1796 | | |
1797 | 4.82M | if !is_match_found && dictionary.is_some() { |
1798 | 3.40M | let (_, cur_data) = data.split_at(cur_ix_masked); |
1799 | 3.40M | is_match_found = SearchInStaticDictionary( |
1800 | 3.40M | dictionary.unwrap(), |
1801 | 3.40M | dictionary_hash, |
1802 | 3.40M | self, |
1803 | 3.40M | cur_data, |
1804 | 3.40M | max_length, |
1805 | 3.40M | max_backward.wrapping_add(gap), |
1806 | 3.40M | max_distance, |
1807 | 3.40M | out, |
1808 | 3.40M | false, |
1809 | 3.40M | ); |
1810 | 3.40M | } |
1811 | 4.82M | is_match_found |
1812 | 4.82M | } <brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 1684 | 550k | fn FindLongestMatch( | 1685 | 550k | &mut self, | 1686 | 550k | dictionary: Option<&BrotliDictionary>, | 1687 | 550k | dictionary_hash: &[u16], | 1688 | 550k | data: &[u8], | 1689 | 550k | ring_buffer_mask: usize, | 1690 | 550k | ring_buffer_break: Option<core::num::NonZeroUsize>, | 1691 | 550k | distance_cache: &[i32], | 1692 | 550k | cur_ix: usize, | 1693 | 550k | max_length: usize, | 1694 | 550k | max_backward: usize, | 1695 | 550k | gap: usize, | 1696 | 550k | max_distance: usize, | 1697 | 550k | out: &mut HasherSearchResult, | 1698 | 550k | ) -> bool { | 1699 | 550k | let opts = self.Opts(); | 1700 | 550k | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 1701 | 550k | let mut is_match_found = false; | 1702 | 550k | let mut best_score: u64 = out.score; | 1703 | 550k | let mut best_len: usize = out.len; | 1704 | 550k | out.len = 0usize; | 1705 | 550k | out.len_x_code = 0usize; | 1706 | 550k | let cur_data = data.split_at(cur_ix_masked).1; | 1707 | 4.21M | for i in 0..self.GetHasherCommon.params.num_last_distances_to_check as usize { | 1708 | 4.21M | let backward: usize = distance_cache[i] as usize; | 1709 | 4.21M | let mut prev_ix: usize = cur_ix.wrapping_sub(backward); | 1710 | 4.21M | if prev_ix >= cur_ix || backward > max_backward { | 1711 | 114k | continue; | 1712 | 4.09M | } | 1713 | 4.09M | prev_ix &= ring_buffer_mask; | 1714 | 4.09M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1715 | 4.09M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1716 | 4.09M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1717 | | { | 1718 | 3.63M | continue; | 1719 | 457k | } | 1720 | 457k | let prev_data = data.split_at(prev_ix).1; | 1721 | | | 1722 | 457k | let unbroken_len = FindMatchLengthWithLimit(prev_data, cur_data, max_length); | 1723 | 457k | if unbroken_len >= 3 || (unbroken_len == 2 && i < 2) { | 1724 | 132k | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1725 | 132k | let mut score: u64 = BackwardReferenceScoreUsingLastDistance(len, opts); | 1726 | 132k | if best_score < score { | 1727 | 123k | if i != 0 { | 1728 | 59.0k | score = score.wrapping_sub(BackwardReferencePenaltyUsingLastDistance(i)); | 1729 | 64.9k | } | 1730 | 123k | if best_score < score { | 1731 | 123k | best_score = score; | 1732 | 123k | best_len = len; | 1733 | 123k | out.len = best_len; | 1734 | 123k | out.distance = backward; | 1735 | 123k | out.score = best_score; | 1736 | 123k | is_match_found = true; | 1737 | 123k | } | 1738 | 8.53k | } | 1739 | 324k | } | 1740 | | } | 1741 | | | 1742 | 550k | let key: u32 = self.HashBytes(cur_data) as u32; | 1743 | 550k | let common_block_bits = self.specialization.block_bits(); | 1744 | 550k | let num_ref_mut = &mut self.num.slice_mut()[key as usize]; | 1745 | 550k | let num_copy = *num_ref_mut; | 1746 | 550k | let bucket: &mut [u32] = self | 1747 | 550k | .buckets | 1748 | 550k | .slice_mut() | 1749 | 550k | .split_at_mut((key << common_block_bits) as usize) | 1750 | 550k | .1 | 1751 | 550k | .split_at_mut(self.specialization.block_size() as usize) | 1752 | 550k | .0; | 1753 | 550k | assert!(bucket.len() > self.specialization.block_mask() as usize); | 1754 | 550k | if num_copy != 0 { | 1755 | 349k | let down: usize = max( | 1756 | 349k | i32::from(num_copy) - self.specialization.block_size() as i32, | 1757 | 349k | 0, | 1758 | 349k | ) as usize; | 1759 | 349k | let mut i = num_copy as usize; | 1760 | 6.73M | while i > down { | 1761 | 6.38M | i -= 1; | 1762 | 6.38M | let mut prev_ix = bucket[i & self.specialization.block_mask() as usize] as usize; | 1763 | 6.38M | let backward = cur_ix.wrapping_sub(prev_ix); | 1764 | 6.38M | prev_ix &= ring_buffer_mask; | 1765 | 6.38M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1766 | 6.38M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1767 | 6.38M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1768 | | { | 1769 | 5.65M | if backward > max_backward { | 1770 | 0 | break; | 1771 | 5.65M | } | 1772 | 5.65M | continue; | 1773 | 724k | } | 1774 | 724k | if backward > max_backward { | 1775 | 0 | break; | 1776 | 724k | } | 1777 | 724k | let prev_data = data.split_at(prev_ix).1; | 1778 | 724k | let unbroken_len = FindMatchLengthWithLimitMin4(prev_data, cur_data, max_length); | 1779 | 724k | if unbroken_len != 0 { | 1780 | 702k | let len = | 1781 | 702k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1782 | 702k | let score: u64 = BackwardReferenceScore(len, backward, opts); | 1783 | 702k | if best_score < score { | 1784 | 205k | best_score = score; | 1785 | 205k | best_len = len; | 1786 | 205k | out.len = best_len; | 1787 | 205k | out.distance = backward; | 1788 | 205k | out.score = best_score; | 1789 | 205k | is_match_found = true; | 1790 | 497k | } | 1791 | 21.5k | } | 1792 | | } | 1793 | 200k | } | 1794 | 550k | bucket[(num_copy as u32 & self.specialization.block_mask()) as usize] = cur_ix as u32; | 1795 | 550k | *num_ref_mut = num_ref_mut.wrapping_add(1); | 1796 | | | 1797 | 550k | if !is_match_found && dictionary.is_some() { | 1798 | 340k | let (_, cur_data) = data.split_at(cur_ix_masked); | 1799 | 340k | is_match_found = SearchInStaticDictionary( | 1800 | 340k | dictionary.unwrap(), | 1801 | 340k | dictionary_hash, | 1802 | 340k | self, | 1803 | 340k | cur_data, | 1804 | 340k | max_length, | 1805 | 340k | max_backward.wrapping_add(gap), | 1806 | 340k | max_distance, | 1807 | 340k | out, | 1808 | 340k | false, | 1809 | 340k | ); | 1810 | 340k | } | 1811 | 550k | is_match_found | 1812 | 550k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 1684 | 3.63M | fn FindLongestMatch( | 1685 | 3.63M | &mut self, | 1686 | 3.63M | dictionary: Option<&BrotliDictionary>, | 1687 | 3.63M | dictionary_hash: &[u16], | 1688 | 3.63M | data: &[u8], | 1689 | 3.63M | ring_buffer_mask: usize, | 1690 | 3.63M | ring_buffer_break: Option<core::num::NonZeroUsize>, | 1691 | 3.63M | distance_cache: &[i32], | 1692 | 3.63M | cur_ix: usize, | 1693 | 3.63M | max_length: usize, | 1694 | 3.63M | max_backward: usize, | 1695 | 3.63M | gap: usize, | 1696 | 3.63M | max_distance: usize, | 1697 | 3.63M | out: &mut HasherSearchResult, | 1698 | 3.63M | ) -> bool { | 1699 | 3.63M | let opts = self.Opts(); | 1700 | 3.63M | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 1701 | 3.63M | let mut is_match_found = false; | 1702 | 3.63M | let mut best_score: u64 = out.score; | 1703 | 3.63M | let mut best_len: usize = out.len; | 1704 | 3.63M | out.len = 0usize; | 1705 | 3.63M | out.len_x_code = 0usize; | 1706 | 3.63M | let cur_data = data.split_at(cur_ix_masked).1; | 1707 | 58.1M | for i in 0..self.GetHasherCommon.params.num_last_distances_to_check as usize { | 1708 | 58.1M | let backward: usize = distance_cache[i] as usize; | 1709 | 58.1M | let mut prev_ix: usize = cur_ix.wrapping_sub(backward); | 1710 | 58.1M | if prev_ix >= cur_ix || backward > max_backward { | 1711 | 2.91M | continue; | 1712 | 55.2M | } | 1713 | 55.2M | prev_ix &= ring_buffer_mask; | 1714 | 55.2M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1715 | 55.2M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1716 | 55.2M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1717 | | { | 1718 | 50.6M | continue; | 1719 | 4.62M | } | 1720 | 4.62M | let prev_data = data.split_at(prev_ix).1; | 1721 | | | 1722 | 4.62M | let unbroken_len = FindMatchLengthWithLimit(prev_data, cur_data, max_length); | 1723 | 4.62M | if unbroken_len >= 3 || (unbroken_len == 2 && i < 2) { | 1724 | 1.00M | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1725 | 1.00M | let mut score: u64 = BackwardReferenceScoreUsingLastDistance(len, opts); | 1726 | 1.00M | if best_score < score { | 1727 | 843k | if i != 0 { | 1728 | 492k | score = score.wrapping_sub(BackwardReferencePenaltyUsingLastDistance(i)); | 1729 | 492k | } | 1730 | 843k | if best_score < score { | 1731 | 843k | best_score = score; | 1732 | 843k | best_len = len; | 1733 | 843k | out.len = best_len; | 1734 | 843k | out.distance = backward; | 1735 | 843k | out.score = best_score; | 1736 | 843k | is_match_found = true; | 1737 | 843k | } | 1738 | 161k | } | 1739 | 3.61M | } | 1740 | | } | 1741 | | | 1742 | 3.63M | let key: u32 = self.HashBytes(cur_data) as u32; | 1743 | 3.63M | let common_block_bits = self.specialization.block_bits(); | 1744 | 3.63M | let num_ref_mut = &mut self.num.slice_mut()[key as usize]; | 1745 | 3.63M | let num_copy = *num_ref_mut; | 1746 | 3.63M | let bucket: &mut [u32] = self | 1747 | 3.63M | .buckets | 1748 | 3.63M | .slice_mut() | 1749 | 3.63M | .split_at_mut((key << common_block_bits) as usize) | 1750 | 3.63M | .1 | 1751 | 3.63M | .split_at_mut(self.specialization.block_size() as usize) | 1752 | 3.63M | .0; | 1753 | 3.63M | assert!(bucket.len() > self.specialization.block_mask() as usize); | 1754 | 3.63M | if num_copy != 0 { | 1755 | 3.03M | let down: usize = max( | 1756 | 3.03M | i32::from(num_copy) - self.specialization.block_size() as i32, | 1757 | 3.03M | 0, | 1758 | 3.03M | ) as usize; | 1759 | 3.03M | let mut i = num_copy as usize; | 1760 | 44.2M | while i > down { | 1761 | 44.1M | i -= 1; | 1762 | 44.1M | let mut prev_ix = bucket[i & self.specialization.block_mask() as usize] as usize; | 1763 | 44.1M | let backward = cur_ix.wrapping_sub(prev_ix); | 1764 | 44.1M | prev_ix &= ring_buffer_mask; | 1765 | 44.1M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1766 | 44.0M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1767 | 44.0M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1768 | | { | 1769 | 36.6M | if backward > max_backward { | 1770 | 1.19M | break; | 1771 | 35.4M | } | 1772 | 35.4M | continue; | 1773 | 7.42M | } | 1774 | 7.42M | if backward > max_backward { | 1775 | 1.71M | break; | 1776 | 5.71M | } | 1777 | 5.71M | let prev_data = data.split_at(prev_ix).1; | 1778 | 5.71M | let unbroken_len = FindMatchLengthWithLimitMin4(prev_data, cur_data, max_length); | 1779 | 5.71M | if unbroken_len != 0 { | 1780 | 5.71M | let len = | 1781 | 5.71M | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1782 | 5.71M | let score: u64 = BackwardReferenceScore(len, backward, opts); | 1783 | 5.71M | if best_score < score { | 1784 | 1.38M | best_score = score; | 1785 | 1.38M | best_len = len; | 1786 | 1.38M | out.len = best_len; | 1787 | 1.38M | out.distance = backward; | 1788 | 1.38M | out.score = best_score; | 1789 | 1.38M | is_match_found = true; | 1790 | 4.32M | } | 1791 | 2.11k | } | 1792 | | } | 1793 | 602k | } | 1794 | 3.63M | bucket[(num_copy as u32 & self.specialization.block_mask()) as usize] = cur_ix as u32; | 1795 | 3.63M | *num_ref_mut = num_ref_mut.wrapping_add(1); | 1796 | | | 1797 | 3.63M | if !is_match_found && dictionary.is_some() { | 1798 | 2.70M | let (_, cur_data) = data.split_at(cur_ix_masked); | 1799 | 2.70M | is_match_found = SearchInStaticDictionary( | 1800 | 2.70M | dictionary.unwrap(), | 1801 | 2.70M | dictionary_hash, | 1802 | 2.70M | self, | 1803 | 2.70M | cur_data, | 1804 | 2.70M | max_length, | 1805 | 2.70M | max_backward.wrapping_add(gap), | 1806 | 2.70M | max_distance, | 1807 | 2.70M | out, | 1808 | 2.70M | false, | 1809 | 2.70M | ); | 1810 | 2.70M | } | 1811 | 3.63M | is_match_found | 1812 | 3.63M | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 1684 | 392k | fn FindLongestMatch( | 1685 | 392k | &mut self, | 1686 | 392k | dictionary: Option<&BrotliDictionary>, | 1687 | 392k | dictionary_hash: &[u16], | 1688 | 392k | data: &[u8], | 1689 | 392k | ring_buffer_mask: usize, | 1690 | 392k | ring_buffer_break: Option<core::num::NonZeroUsize>, | 1691 | 392k | distance_cache: &[i32], | 1692 | 392k | cur_ix: usize, | 1693 | 392k | max_length: usize, | 1694 | 392k | max_backward: usize, | 1695 | 392k | gap: usize, | 1696 | 392k | max_distance: usize, | 1697 | 392k | out: &mut HasherSearchResult, | 1698 | 392k | ) -> bool { | 1699 | 392k | let opts = self.Opts(); | 1700 | 392k | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 1701 | 392k | let mut is_match_found = false; | 1702 | 392k | let mut best_score: u64 = out.score; | 1703 | 392k | let mut best_len: usize = out.len; | 1704 | 392k | out.len = 0usize; | 1705 | 392k | out.len_x_code = 0usize; | 1706 | 392k | let cur_data = data.split_at(cur_ix_masked).1; | 1707 | 1.57M | for i in 0..self.GetHasherCommon.params.num_last_distances_to_check as usize { | 1708 | 1.57M | let backward: usize = distance_cache[i] as usize; | 1709 | 1.57M | let mut prev_ix: usize = cur_ix.wrapping_sub(backward); | 1710 | 1.57M | if prev_ix >= cur_ix || backward > max_backward { | 1711 | 17.2k | continue; | 1712 | 1.55M | } | 1713 | 1.55M | prev_ix &= ring_buffer_mask; | 1714 | 1.55M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1715 | 1.55M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1716 | 1.55M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1717 | | { | 1718 | 1.27M | continue; | 1719 | 275k | } | 1720 | 275k | let prev_data = data.split_at(prev_ix).1; | 1721 | | | 1722 | 275k | let unbroken_len = FindMatchLengthWithLimit(prev_data, cur_data, max_length); | 1723 | 275k | if unbroken_len >= 3 || (unbroken_len == 2 && i < 2) { | 1724 | 101k | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1725 | 101k | let mut score: u64 = BackwardReferenceScoreUsingLastDistance(len, opts); | 1726 | 101k | if best_score < score { | 1727 | 98.9k | if i != 0 { | 1728 | 38.5k | score = score.wrapping_sub(BackwardReferencePenaltyUsingLastDistance(i)); | 1729 | 60.4k | } | 1730 | 98.9k | if best_score < score { | 1731 | 98.9k | best_score = score; | 1732 | 98.9k | best_len = len; | 1733 | 98.9k | out.len = best_len; | 1734 | 98.9k | out.distance = backward; | 1735 | 98.9k | out.score = best_score; | 1736 | 98.9k | is_match_found = true; | 1737 | 98.9k | } | 1738 | 2.81k | } | 1739 | 174k | } | 1740 | | } | 1741 | | | 1742 | 392k | let key: u32 = self.HashBytes(cur_data) as u32; | 1743 | 392k | let common_block_bits = self.specialization.block_bits(); | 1744 | 392k | let num_ref_mut = &mut self.num.slice_mut()[key as usize]; | 1745 | 392k | let num_copy = *num_ref_mut; | 1746 | 392k | let bucket: &mut [u32] = self | 1747 | 392k | .buckets | 1748 | 392k | .slice_mut() | 1749 | 392k | .split_at_mut((key << common_block_bits) as usize) | 1750 | 392k | .1 | 1751 | 392k | .split_at_mut(self.specialization.block_size() as usize) | 1752 | 392k | .0; | 1753 | 392k | assert!(bucket.len() > self.specialization.block_mask() as usize); | 1754 | 392k | if num_copy != 0 { | 1755 | 237k | let down: usize = max( | 1756 | 237k | i32::from(num_copy) - self.specialization.block_size() as i32, | 1757 | 237k | 0, | 1758 | 237k | ) as usize; | 1759 | 237k | let mut i = num_copy as usize; | 1760 | 2.25M | while i > down { | 1761 | 2.01M | i -= 1; | 1762 | 2.01M | let mut prev_ix = bucket[i & self.specialization.block_mask() as usize] as usize; | 1763 | 2.01M | let backward = cur_ix.wrapping_sub(prev_ix); | 1764 | 2.01M | prev_ix &= ring_buffer_mask; | 1765 | 2.01M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1766 | 2.01M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1767 | 2.01M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1768 | | { | 1769 | 1.58M | if backward > max_backward { | 1770 | 0 | break; | 1771 | 1.58M | } | 1772 | 1.58M | continue; | 1773 | 428k | } | 1774 | 428k | if backward > max_backward { | 1775 | 0 | break; | 1776 | 428k | } | 1777 | 428k | let prev_data = data.split_at(prev_ix).1; | 1778 | 428k | let unbroken_len = FindMatchLengthWithLimitMin4(prev_data, cur_data, max_length); | 1779 | 428k | if unbroken_len != 0 { | 1780 | 420k | let len = | 1781 | 420k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1782 | 420k | let score: u64 = BackwardReferenceScore(len, backward, opts); | 1783 | 420k | if best_score < score { | 1784 | 190k | best_score = score; | 1785 | 190k | best_len = len; | 1786 | 190k | out.len = best_len; | 1787 | 190k | out.distance = backward; | 1788 | 190k | out.score = best_score; | 1789 | 190k | is_match_found = true; | 1790 | 230k | } | 1791 | 7.45k | } | 1792 | | } | 1793 | 155k | } | 1794 | 392k | bucket[(num_copy as u32 & self.specialization.block_mask()) as usize] = cur_ix as u32; | 1795 | 392k | *num_ref_mut = num_ref_mut.wrapping_add(1); | 1796 | | | 1797 | 392k | if !is_match_found && dictionary.is_some() { | 1798 | 214k | let (_, cur_data) = data.split_at(cur_ix_masked); | 1799 | 214k | is_match_found = SearchInStaticDictionary( | 1800 | 214k | dictionary.unwrap(), | 1801 | 214k | dictionary_hash, | 1802 | 214k | self, | 1803 | 214k | cur_data, | 1804 | 214k | max_length, | 1805 | 214k | max_backward.wrapping_add(gap), | 1806 | 214k | max_distance, | 1807 | 214k | out, | 1808 | 214k | false, | 1809 | 214k | ); | 1810 | 214k | } | 1811 | 392k | is_match_found | 1812 | 392k | } |
<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch Line | Count | Source | 1684 | 242k | fn FindLongestMatch( | 1685 | 242k | &mut self, | 1686 | 242k | dictionary: Option<&BrotliDictionary>, | 1687 | 242k | dictionary_hash: &[u16], | 1688 | 242k | data: &[u8], | 1689 | 242k | ring_buffer_mask: usize, | 1690 | 242k | ring_buffer_break: Option<core::num::NonZeroUsize>, | 1691 | 242k | distance_cache: &[i32], | 1692 | 242k | cur_ix: usize, | 1693 | 242k | max_length: usize, | 1694 | 242k | max_backward: usize, | 1695 | 242k | gap: usize, | 1696 | 242k | max_distance: usize, | 1697 | 242k | out: &mut HasherSearchResult, | 1698 | 242k | ) -> bool { | 1699 | 242k | let opts = self.Opts(); | 1700 | 242k | let cur_ix_masked: usize = cur_ix & ring_buffer_mask; | 1701 | 242k | let mut is_match_found = false; | 1702 | 242k | let mut best_score: u64 = out.score; | 1703 | 242k | let mut best_len: usize = out.len; | 1704 | 242k | out.len = 0usize; | 1705 | 242k | out.len_x_code = 0usize; | 1706 | 242k | let cur_data = data.split_at(cur_ix_masked).1; | 1707 | 2.42M | for i in 0..self.GetHasherCommon.params.num_last_distances_to_check as usize { | 1708 | 2.42M | let backward: usize = distance_cache[i] as usize; | 1709 | 2.42M | let mut prev_ix: usize = cur_ix.wrapping_sub(backward); | 1710 | 2.42M | if prev_ix >= cur_ix || backward > max_backward { | 1711 | 130k | continue; | 1712 | 2.29M | } | 1713 | 2.29M | prev_ix &= ring_buffer_mask; | 1714 | 2.29M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1715 | 2.29M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1716 | 2.29M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1717 | | { | 1718 | 2.09M | continue; | 1719 | 198k | } | 1720 | 198k | let prev_data = data.split_at(prev_ix).1; | 1721 | | | 1722 | 198k | let unbroken_len = FindMatchLengthWithLimit(prev_data, cur_data, max_length); | 1723 | 198k | if unbroken_len >= 3 || (unbroken_len == 2 && i < 2) { | 1724 | 63.1k | let len = fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1725 | 63.1k | let mut score: u64 = BackwardReferenceScoreUsingLastDistance(len, opts); | 1726 | 63.1k | if best_score < score { | 1727 | 59.5k | if i != 0 { | 1728 | 28.3k | score = score.wrapping_sub(BackwardReferencePenaltyUsingLastDistance(i)); | 1729 | 31.1k | } | 1730 | 59.5k | if best_score < score { | 1731 | 59.4k | best_score = score; | 1732 | 59.4k | best_len = len; | 1733 | 59.4k | out.len = best_len; | 1734 | 59.4k | out.distance = backward; | 1735 | 59.4k | out.score = best_score; | 1736 | 59.4k | is_match_found = true; | 1737 | 59.4k | } | 1738 | 3.69k | } | 1739 | 135k | } | 1740 | | } | 1741 | | | 1742 | 242k | let key: u32 = self.HashBytes(cur_data) as u32; | 1743 | 242k | let common_block_bits = self.specialization.block_bits(); | 1744 | 242k | let num_ref_mut = &mut self.num.slice_mut()[key as usize]; | 1745 | 242k | let num_copy = *num_ref_mut; | 1746 | 242k | let bucket: &mut [u32] = self | 1747 | 242k | .buckets | 1748 | 242k | .slice_mut() | 1749 | 242k | .split_at_mut((key << common_block_bits) as usize) | 1750 | 242k | .1 | 1751 | 242k | .split_at_mut(self.specialization.block_size() as usize) | 1752 | 242k | .0; | 1753 | 242k | assert!(bucket.len() > self.specialization.block_mask() as usize); | 1754 | 242k | if num_copy != 0 { | 1755 | 107k | let down: usize = max( | 1756 | 107k | i32::from(num_copy) - self.specialization.block_size() as i32, | 1757 | 107k | 0, | 1758 | 107k | ) as usize; | 1759 | 107k | let mut i = num_copy as usize; | 1760 | 2.03M | while i > down { | 1761 | 1.92M | i -= 1; | 1762 | 1.92M | let mut prev_ix = bucket[i & self.specialization.block_mask() as usize] as usize; | 1763 | 1.92M | let backward = cur_ix.wrapping_sub(prev_ix); | 1764 | 1.92M | prev_ix &= ring_buffer_mask; | 1765 | 1.92M | if (cur_ix_masked.wrapping_add(best_len) > ring_buffer_mask | 1766 | 1.92M | || prev_ix.wrapping_add(best_len) > ring_buffer_mask | 1767 | 1.92M | || cur_data[best_len] != data[prev_ix.wrapping_add(best_len)]) | 1768 | | { | 1769 | 1.65M | if backward > max_backward { | 1770 | 0 | break; | 1771 | 1.65M | } | 1772 | 1.65M | continue; | 1773 | 265k | } | 1774 | 265k | if backward > max_backward { | 1775 | 0 | break; | 1776 | 265k | } | 1777 | 265k | let prev_data = data.split_at(prev_ix).1; | 1778 | 265k | let unbroken_len = FindMatchLengthWithLimitMin4(prev_data, cur_data, max_length); | 1779 | 265k | if unbroken_len != 0 { | 1780 | 262k | let len = | 1781 | 262k | fix_unbroken_len(unbroken_len, prev_ix, cur_ix_masked, ring_buffer_break); | 1782 | 262k | let score: u64 = BackwardReferenceScore(len, backward, opts); | 1783 | 262k | if best_score < score { | 1784 | 96.5k | best_score = score; | 1785 | 96.5k | best_len = len; | 1786 | 96.5k | out.len = best_len; | 1787 | 96.5k | out.distance = backward; | 1788 | 96.5k | out.score = best_score; | 1789 | 96.5k | is_match_found = true; | 1790 | 166k | } | 1791 | 2.48k | } | 1792 | | } | 1793 | 134k | } | 1794 | 242k | bucket[(num_copy as u32 & self.specialization.block_mask()) as usize] = cur_ix as u32; | 1795 | 242k | *num_ref_mut = num_ref_mut.wrapping_add(1); | 1796 | | | 1797 | 242k | if !is_match_found && dictionary.is_some() { | 1798 | 147k | let (_, cur_data) = data.split_at(cur_ix_masked); | 1799 | 147k | is_match_found = SearchInStaticDictionary( | 1800 | 147k | dictionary.unwrap(), | 1801 | 147k | dictionary_hash, | 1802 | 147k | self, | 1803 | 147k | cur_data, | 1804 | 147k | max_length, | 1805 | 147k | max_backward.wrapping_add(gap), | 1806 | 147k | max_distance, | 1807 | 147k | out, | 1808 | 147k | false, | 1809 | 147k | ); | 1810 | 147k | } | 1811 | 242k | is_match_found | 1812 | 242k | } |
Unexecuted instantiation: <brotli::enc::backward_references::AdvHasher<_, _> as brotli::enc::backward_references::AnyHasher>::FindLongestMatch |
1813 | | } |
1814 | | |
1815 | | pub struct BankH40 { |
1816 | | pub slots: [SlotH40; 65536], |
1817 | | } |
1818 | | |
1819 | | pub struct BankH41 { |
1820 | | pub slots: [SlotH41; 65536], |
1821 | | } |
1822 | | |
1823 | | pub struct BankH42 { |
1824 | | pub slots: [SlotH42; 512], |
1825 | | } |
1826 | | |
1827 | | pub struct SlotH40 { |
1828 | | pub delta: u16, |
1829 | | pub next: u16, |
1830 | | } |
1831 | | pub struct SlotH41 { |
1832 | | pub delta: u16, |
1833 | | pub next: u16, |
1834 | | } |
1835 | | |
1836 | | pub struct SlotH42 { |
1837 | | pub delta: u16, |
1838 | | pub next: u16, |
1839 | | } |
1840 | | |
1841 | | // UNSUPPORTED, for now. |
1842 | | pub struct H40 { |
1843 | | pub common: Struct1, |
1844 | | pub addr: [u32; 32768], |
1845 | | pub head: [u16; 32768], |
1846 | | pub tiny_hash: [u8; 65536], |
1847 | | pub banks: [BankH40; 1], |
1848 | | pub free_slot_idx: [u16; 1], |
1849 | | pub max_hops: usize, |
1850 | | } |
1851 | | |
1852 | | pub struct H41 { |
1853 | | pub common: Struct1, |
1854 | | pub addr: [u32; 32768], |
1855 | | pub head: [u16; 32768], |
1856 | | pub tiny_hash: [u8; 65536], |
1857 | | pub banks: [BankH41; 1], |
1858 | | pub free_slot_idx: [u16; 1], |
1859 | | pub max_hops: usize, |
1860 | | } |
1861 | | |
1862 | | pub struct H42 { |
1863 | | pub common: Struct1, |
1864 | | pub addr: [u32; 32768], |
1865 | | pub head: [u16; 32768], |
1866 | | pub tiny_hash: [u8; 65536], |
1867 | | pub banks: [BankH42; 512], |
1868 | | pub max_hops: usize, |
1869 | | } |
1870 | | |
1871 | 1.54M | fn BackwardReferenceScoreUsingLastDistance(copy_length: usize, h9_opts: H9Opts) -> u64 { |
1872 | 1.54M | ((h9_opts.literal_byte_score as u64) >> 2) |
1873 | 1.54M | .wrapping_mul(copy_length as u64) |
1874 | 1.54M | .wrapping_add((30u64 * 8u64).wrapping_mul(::core::mem::size_of::<u64>() as u64)) |
1875 | 1.54M | .wrapping_add(15) |
1876 | 1.54M | } |
1877 | | |
1878 | 8.02M | fn BackwardReferenceScore( |
1879 | 8.02M | copy_length: usize, |
1880 | 8.02M | backward_reference_offset: usize, |
1881 | 8.02M | h9_opts: H9Opts, |
1882 | 8.02M | ) -> u64 { |
1883 | 8.02M | (30u64 * 8u64) |
1884 | 8.02M | .wrapping_mul(::core::mem::size_of::<u64>() as u64) |
1885 | 8.02M | .wrapping_add(((h9_opts.literal_byte_score as usize) >> 2).wrapping_mul(copy_length) as u64) |
1886 | 8.02M | .wrapping_sub( |
1887 | 8.02M | (30u64).wrapping_mul(Log2FloorNonZero(backward_reference_offset as u64) as u64), |
1888 | | ) |
1889 | 8.02M | } |
1890 | | |
1891 | 775k | fn Hash14(data: &[u8]) -> u32 { |
1892 | 775k | let h: u32 = BROTLI_UNALIGNED_LOAD32(data).wrapping_mul(kHashMul32); |
1893 | 775k | h >> (32i32 - 14i32) |
1894 | 775k | } |
1895 | | |
1896 | 233k | fn TestStaticDictionaryItem( |
1897 | 233k | dictionary: &BrotliDictionary, |
1898 | 233k | item: usize, |
1899 | 233k | data: &[u8], |
1900 | 233k | max_length: usize, |
1901 | 233k | max_backward: usize, |
1902 | 233k | max_distance: usize, |
1903 | 233k | h9_opts: H9Opts, |
1904 | 233k | out: &mut HasherSearchResult, |
1905 | 233k | ) -> i32 { |
1906 | | let backward: usize; |
1907 | | |
1908 | 233k | let len: usize = item & 0x1fusize; |
1909 | 233k | let dist: usize = item >> 5; |
1910 | 233k | let offset: usize = |
1911 | 233k | (dictionary.offsets_by_length[len] as usize).wrapping_add(len.wrapping_mul(dist)); |
1912 | 233k | if len > max_length { |
1913 | 906 | return 0i32; |
1914 | 233k | } |
1915 | 233k | let matchlen: usize = FindMatchLengthWithLimit(data, &dictionary.data[offset..], len); |
1916 | 233k | if matchlen.wrapping_add(kCutoffTransformsCount as usize) <= len || matchlen == 0usize { |
1917 | 190k | return 0i32; |
1918 | 42.7k | } |
1919 | 42.7k | { |
1920 | 42.7k | let cut: u64 = len.wrapping_sub(matchlen) as u64; |
1921 | 42.7k | let transform_id: usize = |
1922 | 42.7k | (cut << 2).wrapping_add(kCutoffTransforms >> cut.wrapping_mul(6) & 0x3f) as usize; |
1923 | 42.7k | backward = max_backward |
1924 | 42.7k | .wrapping_add(dist) |
1925 | 42.7k | .wrapping_add(1) |
1926 | 42.7k | .wrapping_add(transform_id << dictionary.size_bits_by_length[len] as i32); |
1927 | 42.7k | } |
1928 | 42.7k | if backward > max_distance { |
1929 | 0 | return 0i32; |
1930 | 42.7k | } |
1931 | 42.7k | let score: u64 = BackwardReferenceScore(matchlen, backward, h9_opts); |
1932 | 42.7k | if score < out.score { |
1933 | 20.0k | return 0i32; |
1934 | 22.7k | } |
1935 | 22.7k | out.len = matchlen; |
1936 | 22.7k | out.len_x_code = len ^ matchlen; |
1937 | 22.7k | out.distance = backward; |
1938 | 22.7k | out.score = score; |
1939 | 22.7k | 1i32 |
1940 | 233k | } |
1941 | | |
1942 | 5.80M | fn SearchInStaticDictionary<HasherType: AnyHasher>( |
1943 | 5.80M | dictionary: &BrotliDictionary, |
1944 | 5.80M | dictionary_hash: &[u16], |
1945 | 5.80M | handle: &mut HasherType, |
1946 | 5.80M | data: &[u8], |
1947 | 5.80M | max_length: usize, |
1948 | 5.80M | max_backward: usize, |
1949 | 5.80M | max_distance: usize, |
1950 | 5.80M | out: &mut HasherSearchResult, |
1951 | 5.80M | shallow: bool, |
1952 | 5.80M | ) -> bool { |
1953 | | let mut key: usize; |
1954 | | let mut i: usize; |
1955 | 5.80M | let mut is_match_found = false; |
1956 | 5.80M | let opts = handle.Opts(); |
1957 | 5.80M | let xself: &mut Struct1 = handle.GetHasherCommon(); |
1958 | 5.80M | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { |
1959 | 5.02M | return false; |
1960 | 775k | } |
1961 | 775k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? |
1962 | 775k | i = 0usize; |
1963 | 1.92M | while i < if shallow { 1 } else { 2 } { |
1964 | | { |
1965 | 1.14M | let item: usize = dictionary_hash[key] as usize; |
1966 | 1.14M | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); |
1967 | 1.14M | if item != 0usize { |
1968 | 233k | let item_matches: i32 = TestStaticDictionaryItem( |
1969 | 233k | dictionary, |
1970 | 233k | item, |
1971 | 233k | data, |
1972 | 233k | max_length, |
1973 | 233k | max_backward, |
1974 | 233k | max_distance, |
1975 | 233k | opts, |
1976 | 233k | out, |
1977 | | ); |
1978 | 233k | if item_matches != 0 { |
1979 | 22.7k | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); |
1980 | 22.7k | is_match_found = true; |
1981 | 211k | } |
1982 | 916k | } |
1983 | | } |
1984 | 1.14M | i = i.wrapping_add(1); |
1985 | 1.14M | key = key.wrapping_add(1); |
1986 | | } |
1987 | 775k | is_match_found |
1988 | 5.80M | } brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 1942 | 12.3k | fn SearchInStaticDictionary<HasherType: AnyHasher>( | 1943 | 12.3k | dictionary: &BrotliDictionary, | 1944 | 12.3k | dictionary_hash: &[u16], | 1945 | 12.3k | handle: &mut HasherType, | 1946 | 12.3k | data: &[u8], | 1947 | 12.3k | max_length: usize, | 1948 | 12.3k | max_backward: usize, | 1949 | 12.3k | max_distance: usize, | 1950 | 12.3k | out: &mut HasherSearchResult, | 1951 | 12.3k | shallow: bool, | 1952 | 12.3k | ) -> bool { | 1953 | | let mut key: usize; | 1954 | | let mut i: usize; | 1955 | 12.3k | let mut is_match_found = false; | 1956 | 12.3k | let opts = handle.Opts(); | 1957 | 12.3k | let xself: &mut Struct1 = handle.GetHasherCommon(); | 1958 | 12.3k | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { | 1959 | 1.81k | return false; | 1960 | 10.5k | } | 1961 | 10.5k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? | 1962 | 10.5k | i = 0usize; | 1963 | 21.1k | while i < if shallow { 1 } else { 2 } { | 1964 | | { | 1965 | 10.5k | let item: usize = dictionary_hash[key] as usize; | 1966 | 10.5k | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); | 1967 | 10.5k | if item != 0usize { | 1968 | 2.12k | let item_matches: i32 = TestStaticDictionaryItem( | 1969 | 2.12k | dictionary, | 1970 | 2.12k | item, | 1971 | 2.12k | data, | 1972 | 2.12k | max_length, | 1973 | 2.12k | max_backward, | 1974 | 2.12k | max_distance, | 1975 | 2.12k | opts, | 1976 | 2.12k | out, | 1977 | | ); | 1978 | 2.12k | if item_matches != 0 { | 1979 | 182 | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); | 1980 | 182 | is_match_found = true; | 1981 | 1.94k | } | 1982 | 8.45k | } | 1983 | | } | 1984 | 10.5k | i = i.wrapping_add(1); | 1985 | 10.5k | key = key.wrapping_add(1); | 1986 | | } | 1987 | 10.5k | is_match_found | 1988 | 12.3k | } |
Unexecuted instantiation: brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>>> brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 1942 | 1.24M | fn SearchInStaticDictionary<HasherType: AnyHasher>( | 1943 | 1.24M | dictionary: &BrotliDictionary, | 1944 | 1.24M | dictionary_hash: &[u16], | 1945 | 1.24M | handle: &mut HasherType, | 1946 | 1.24M | data: &[u8], | 1947 | 1.24M | max_length: usize, | 1948 | 1.24M | max_backward: usize, | 1949 | 1.24M | max_distance: usize, | 1950 | 1.24M | out: &mut HasherSearchResult, | 1951 | 1.24M | shallow: bool, | 1952 | 1.24M | ) -> bool { | 1953 | | let mut key: usize; | 1954 | | let mut i: usize; | 1955 | 1.24M | let mut is_match_found = false; | 1956 | 1.24M | let opts = handle.Opts(); | 1957 | 1.24M | let xself: &mut Struct1 = handle.GetHasherCommon(); | 1958 | 1.24M | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { | 1959 | 856k | return false; | 1960 | 390k | } | 1961 | 390k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? | 1962 | 390k | i = 0usize; | 1963 | 780k | while i < if shallow { 1 } else { 2 } { | 1964 | | { | 1965 | 390k | let item: usize = dictionary_hash[key] as usize; | 1966 | 390k | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); | 1967 | 390k | if item != 0usize { | 1968 | 75.9k | let item_matches: i32 = TestStaticDictionaryItem( | 1969 | 75.9k | dictionary, | 1970 | 75.9k | item, | 1971 | 75.9k | data, | 1972 | 75.9k | max_length, | 1973 | 75.9k | max_backward, | 1974 | 75.9k | max_distance, | 1975 | 75.9k | opts, | 1976 | 75.9k | out, | 1977 | | ); | 1978 | 75.9k | if item_matches != 0 { | 1979 | 10.6k | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); | 1980 | 10.6k | is_match_found = true; | 1981 | 65.3k | } | 1982 | 314k | } | 1983 | | } | 1984 | 390k | i = i.wrapping_add(1); | 1985 | 390k | key = key.wrapping_add(1); | 1986 | | } | 1987 | 390k | is_match_found | 1988 | 1.24M | } |
Unexecuted instantiation: brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>>> brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 1942 | 1.13M | fn SearchInStaticDictionary<HasherType: AnyHasher>( | 1943 | 1.13M | dictionary: &BrotliDictionary, | 1944 | 1.13M | dictionary_hash: &[u16], | 1945 | 1.13M | handle: &mut HasherType, | 1946 | 1.13M | data: &[u8], | 1947 | 1.13M | max_length: usize, | 1948 | 1.13M | max_backward: usize, | 1949 | 1.13M | max_distance: usize, | 1950 | 1.13M | out: &mut HasherSearchResult, | 1951 | 1.13M | shallow: bool, | 1952 | 1.13M | ) -> bool { | 1953 | | let mut key: usize; | 1954 | | let mut i: usize; | 1955 | 1.13M | let mut is_match_found = false; | 1956 | 1.13M | let opts = handle.Opts(); | 1957 | 1.13M | let xself: &mut Struct1 = handle.GetHasherCommon(); | 1958 | 1.13M | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { | 1959 | 1.03M | return false; | 1960 | 102k | } | 1961 | 102k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? | 1962 | 102k | i = 0usize; | 1963 | 306k | while i < if shallow { 1 } else { 2 } { | 1964 | | { | 1965 | 204k | let item: usize = dictionary_hash[key] as usize; | 1966 | 204k | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); | 1967 | 204k | if item != 0usize { | 1968 | 41.0k | let item_matches: i32 = TestStaticDictionaryItem( | 1969 | 41.0k | dictionary, | 1970 | 41.0k | item, | 1971 | 41.0k | data, | 1972 | 41.0k | max_length, | 1973 | 41.0k | max_backward, | 1974 | 41.0k | max_distance, | 1975 | 41.0k | opts, | 1976 | 41.0k | out, | 1977 | | ); | 1978 | 41.0k | if item_matches != 0 { | 1979 | 2.20k | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); | 1980 | 2.20k | is_match_found = true; | 1981 | 38.8k | } | 1982 | 163k | } | 1983 | | } | 1984 | 204k | i = i.wrapping_add(1); | 1985 | 204k | key = key.wrapping_add(1); | 1986 | | } | 1987 | 102k | is_match_found | 1988 | 1.13M | } |
brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 1942 | 340k | fn SearchInStaticDictionary<HasherType: AnyHasher>( | 1943 | 340k | dictionary: &BrotliDictionary, | 1944 | 340k | dictionary_hash: &[u16], | 1945 | 340k | handle: &mut HasherType, | 1946 | 340k | data: &[u8], | 1947 | 340k | max_length: usize, | 1948 | 340k | max_backward: usize, | 1949 | 340k | max_distance: usize, | 1950 | 340k | out: &mut HasherSearchResult, | 1951 | 340k | shallow: bool, | 1952 | 340k | ) -> bool { | 1953 | | let mut key: usize; | 1954 | | let mut i: usize; | 1955 | 340k | let mut is_match_found = false; | 1956 | 340k | let opts = handle.Opts(); | 1957 | 340k | let xself: &mut Struct1 = handle.GetHasherCommon(); | 1958 | 340k | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { | 1959 | 265k | return false; | 1960 | 74.9k | } | 1961 | 74.9k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? | 1962 | 74.9k | i = 0usize; | 1963 | 224k | while i < if shallow { 1 } else { 2 } { | 1964 | | { | 1965 | 149k | let item: usize = dictionary_hash[key] as usize; | 1966 | 149k | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); | 1967 | 149k | if item != 0usize { | 1968 | 31.7k | let item_matches: i32 = TestStaticDictionaryItem( | 1969 | 31.7k | dictionary, | 1970 | 31.7k | item, | 1971 | 31.7k | data, | 1972 | 31.7k | max_length, | 1973 | 31.7k | max_backward, | 1974 | 31.7k | max_distance, | 1975 | 31.7k | opts, | 1976 | 31.7k | out, | 1977 | | ); | 1978 | 31.7k | if item_matches != 0 { | 1979 | 2.73k | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); | 1980 | 2.73k | is_match_found = true; | 1981 | 28.9k | } | 1982 | 118k | } | 1983 | | } | 1984 | 149k | i = i.wrapping_add(1); | 1985 | 149k | key = key.wrapping_add(1); | 1986 | | } | 1987 | 74.9k | is_match_found | 1988 | 340k | } |
brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 1942 | 2.70M | fn SearchInStaticDictionary<HasherType: AnyHasher>( | 1943 | 2.70M | dictionary: &BrotliDictionary, | 1944 | 2.70M | dictionary_hash: &[u16], | 1945 | 2.70M | handle: &mut HasherType, | 1946 | 2.70M | data: &[u8], | 1947 | 2.70M | max_length: usize, | 1948 | 2.70M | max_backward: usize, | 1949 | 2.70M | max_distance: usize, | 1950 | 2.70M | out: &mut HasherSearchResult, | 1951 | 2.70M | shallow: bool, | 1952 | 2.70M | ) -> bool { | 1953 | | let mut key: usize; | 1954 | | let mut i: usize; | 1955 | 2.70M | let mut is_match_found = false; | 1956 | 2.70M | let opts = handle.Opts(); | 1957 | 2.70M | let xself: &mut Struct1 = handle.GetHasherCommon(); | 1958 | 2.70M | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { | 1959 | 2.58M | return false; | 1960 | 120k | } | 1961 | 120k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? | 1962 | 120k | i = 0usize; | 1963 | 360k | while i < if shallow { 1 } else { 2 } { | 1964 | | { | 1965 | 240k | let item: usize = dictionary_hash[key] as usize; | 1966 | 240k | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); | 1967 | 240k | if item != 0usize { | 1968 | 49.9k | let item_matches: i32 = TestStaticDictionaryItem( | 1969 | 49.9k | dictionary, | 1970 | 49.9k | item, | 1971 | 49.9k | data, | 1972 | 49.9k | max_length, | 1973 | 49.9k | max_backward, | 1974 | 49.9k | max_distance, | 1975 | 49.9k | opts, | 1976 | 49.9k | out, | 1977 | | ); | 1978 | 49.9k | if item_matches != 0 { | 1979 | 4.14k | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); | 1980 | 4.14k | is_match_found = true; | 1981 | 45.7k | } | 1982 | 190k | } | 1983 | | } | 1984 | 240k | i = i.wrapping_add(1); | 1985 | 240k | key = key.wrapping_add(1); | 1986 | | } | 1987 | 120k | is_match_found | 1988 | 2.70M | } |
brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 1942 | 214k | fn SearchInStaticDictionary<HasherType: AnyHasher>( | 1943 | 214k | dictionary: &BrotliDictionary, | 1944 | 214k | dictionary_hash: &[u16], | 1945 | 214k | handle: &mut HasherType, | 1946 | 214k | data: &[u8], | 1947 | 214k | max_length: usize, | 1948 | 214k | max_backward: usize, | 1949 | 214k | max_distance: usize, | 1950 | 214k | out: &mut HasherSearchResult, | 1951 | 214k | shallow: bool, | 1952 | 214k | ) -> bool { | 1953 | | let mut key: usize; | 1954 | | let mut i: usize; | 1955 | 214k | let mut is_match_found = false; | 1956 | 214k | let opts = handle.Opts(); | 1957 | 214k | let xself: &mut Struct1 = handle.GetHasherCommon(); | 1958 | 214k | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { | 1959 | 182k | return false; | 1960 | 31.5k | } | 1961 | 31.5k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? | 1962 | 31.5k | i = 0usize; | 1963 | 94.7k | while i < if shallow { 1 } else { 2 } { | 1964 | | { | 1965 | 63.1k | let item: usize = dictionary_hash[key] as usize; | 1966 | 63.1k | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); | 1967 | 63.1k | if item != 0usize { | 1968 | 13.5k | let item_matches: i32 = TestStaticDictionaryItem( | 1969 | 13.5k | dictionary, | 1970 | 13.5k | item, | 1971 | 13.5k | data, | 1972 | 13.5k | max_length, | 1973 | 13.5k | max_backward, | 1974 | 13.5k | max_distance, | 1975 | 13.5k | opts, | 1976 | 13.5k | out, | 1977 | | ); | 1978 | 13.5k | if item_matches != 0 { | 1979 | 1.12k | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); | 1980 | 1.12k | is_match_found = true; | 1981 | 12.3k | } | 1982 | 49.6k | } | 1983 | | } | 1984 | 63.1k | i = i.wrapping_add(1); | 1985 | 63.1k | key = key.wrapping_add(1); | 1986 | | } | 1987 | 31.5k | is_match_found | 1988 | 214k | } |
brotli::enc::backward_references::SearchInStaticDictionary::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 1942 | 147k | fn SearchInStaticDictionary<HasherType: AnyHasher>( | 1943 | 147k | dictionary: &BrotliDictionary, | 1944 | 147k | dictionary_hash: &[u16], | 1945 | 147k | handle: &mut HasherType, | 1946 | 147k | data: &[u8], | 1947 | 147k | max_length: usize, | 1948 | 147k | max_backward: usize, | 1949 | 147k | max_distance: usize, | 1950 | 147k | out: &mut HasherSearchResult, | 1951 | 147k | shallow: bool, | 1952 | 147k | ) -> bool { | 1953 | | let mut key: usize; | 1954 | | let mut i: usize; | 1955 | 147k | let mut is_match_found = false; | 1956 | 147k | let opts = handle.Opts(); | 1957 | 147k | let xself: &mut Struct1 = handle.GetHasherCommon(); | 1958 | 147k | if xself.dict_num_matches < xself.dict_num_lookups >> 7 { | 1959 | 101k | return false; | 1960 | 45.8k | } | 1961 | 45.8k | key = (Hash14(data) << 1) as usize; //FIXME: works for any kind of hasher?? | 1962 | 45.8k | i = 0usize; | 1963 | 137k | while i < if shallow { 1 } else { 2 } { | 1964 | | { | 1965 | 91.6k | let item: usize = dictionary_hash[key] as usize; | 1966 | 91.6k | xself.dict_num_lookups = xself.dict_num_lookups.wrapping_add(1); | 1967 | 91.6k | if item != 0usize { | 1968 | 19.6k | let item_matches: i32 = TestStaticDictionaryItem( | 1969 | 19.6k | dictionary, | 1970 | 19.6k | item, | 1971 | 19.6k | data, | 1972 | 19.6k | max_length, | 1973 | 19.6k | max_backward, | 1974 | 19.6k | max_distance, | 1975 | 19.6k | opts, | 1976 | 19.6k | out, | 1977 | | ); | 1978 | 19.6k | if item_matches != 0 { | 1979 | 1.74k | xself.dict_num_matches = xself.dict_num_matches.wrapping_add(1); | 1980 | 1.74k | is_match_found = true; | 1981 | 17.9k | } | 1982 | 71.9k | } | 1983 | | } | 1984 | 91.6k | i = i.wrapping_add(1); | 1985 | 91.6k | key = key.wrapping_add(1); | 1986 | | } | 1987 | 45.8k | is_match_found | 1988 | 147k | } |
Unexecuted instantiation: brotli::enc::backward_references::SearchInStaticDictionary::<_> |
1989 | | |
1990 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> CloneWithAlloc<Alloc> |
1991 | | for BasicHasher<H2Sub<Alloc>> |
1992 | | { |
1993 | 0 | fn clone_with_alloc(&self, m: &mut Alloc) -> Self { |
1994 | 0 | let mut ret = BasicHasher::<H2Sub<Alloc>> { |
1995 | 0 | GetHasherCommon: self.GetHasherCommon.clone(), |
1996 | 0 | buckets_: H2Sub { |
1997 | 0 | buckets_: allocate::<u32, _>(m, self.buckets_.buckets_.len()), |
1998 | 0 | }, |
1999 | 0 | h9_opts: self.h9_opts, |
2000 | 0 | }; |
2001 | 0 | ret.buckets_ |
2002 | 0 | .buckets_ |
2003 | 0 | .slice_mut() |
2004 | 0 | .clone_from_slice(self.buckets_.buckets_.slice()); |
2005 | 0 | ret |
2006 | 0 | } |
2007 | | } |
2008 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> CloneWithAlloc<Alloc> |
2009 | | for BasicHasher<H3Sub<Alloc>> |
2010 | | { |
2011 | 0 | fn clone_with_alloc(&self, m: &mut Alloc) -> Self { |
2012 | 0 | let mut ret = BasicHasher::<H3Sub<Alloc>> { |
2013 | 0 | GetHasherCommon: self.GetHasherCommon.clone(), |
2014 | 0 | buckets_: H3Sub::<Alloc> { |
2015 | 0 | buckets_: allocate::<u32, _>(m, self.buckets_.buckets_.len()), |
2016 | 0 | }, |
2017 | 0 | h9_opts: self.h9_opts, |
2018 | 0 | }; |
2019 | 0 | ret.buckets_ |
2020 | 0 | .buckets_ |
2021 | 0 | .slice_mut() |
2022 | 0 | .clone_from_slice(self.buckets_.buckets_.slice()); |
2023 | 0 | ret |
2024 | 0 | } |
2025 | | } |
2026 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> CloneWithAlloc<Alloc> |
2027 | | for BasicHasher<H4Sub<Alloc>> |
2028 | | { |
2029 | 0 | fn clone_with_alloc(&self, m: &mut Alloc) -> Self { |
2030 | 0 | let mut ret = BasicHasher::<H4Sub<Alloc>> { |
2031 | 0 | GetHasherCommon: self.GetHasherCommon.clone(), |
2032 | 0 | buckets_: H4Sub::<Alloc> { |
2033 | 0 | buckets_: allocate::<u32, _>(m, self.buckets_.buckets_.len()), |
2034 | 0 | }, |
2035 | 0 | h9_opts: self.h9_opts, |
2036 | 0 | }; |
2037 | 0 | ret.buckets_ |
2038 | 0 | .buckets_ |
2039 | 0 | .slice_mut() |
2040 | 0 | .clone_from_slice(self.buckets_.buckets_.slice()); |
2041 | 0 | ret |
2042 | 0 | } |
2043 | | } |
2044 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> CloneWithAlloc<Alloc> |
2045 | | for BasicHasher<H54Sub<Alloc>> |
2046 | | { |
2047 | 0 | fn clone_with_alloc(&self, m: &mut Alloc) -> Self { |
2048 | 0 | let mut ret = BasicHasher::<H54Sub<Alloc>> { |
2049 | 0 | GetHasherCommon: self.GetHasherCommon.clone(), |
2050 | 0 | buckets_: H54Sub::<Alloc> { |
2051 | 0 | buckets_: allocate::<u32, _>(m, self.buckets_.len()), |
2052 | 0 | }, |
2053 | 0 | h9_opts: self.h9_opts, |
2054 | 0 | }; |
2055 | 0 | ret.buckets_ |
2056 | 0 | .buckets_ |
2057 | 0 | .slice_mut() |
2058 | 0 | .clone_from_slice(self.buckets_.buckets_.slice()); |
2059 | 0 | ret |
2060 | 0 | } |
2061 | | } |
2062 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> CloneWithAlloc<Alloc> for H9<Alloc> { |
2063 | 0 | fn clone_with_alloc(&self, m: &mut Alloc) -> Self { |
2064 | 0 | let mut num = allocate::<u16, _>(m, self.num_.len()); |
2065 | 0 | num.slice_mut().clone_from_slice(self.num_.slice()); |
2066 | 0 | let mut buckets = allocate::<u32, _>(m, self.buckets_.len()); |
2067 | 0 | buckets.slice_mut().clone_from_slice(self.buckets_.slice()); |
2068 | 0 | H9::<Alloc> { |
2069 | 0 | num_: num, |
2070 | 0 | buckets_: buckets, |
2071 | 0 | dict_search_stats_: self.dict_search_stats_.clone(), |
2072 | 0 | h9_opts: self.h9_opts, |
2073 | 0 | } |
2074 | 0 | } |
2075 | | } |
2076 | | impl< |
2077 | | Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>, |
2078 | | Special: AdvHashSpecialization + Sized + Clone, |
2079 | | > CloneWithAlloc<Alloc> for AdvHasher<Special, Alloc> |
2080 | | { |
2081 | 0 | fn clone_with_alloc(&self, m: &mut Alloc) -> Self { |
2082 | 0 | let mut num = allocate::<u16, _>(m, self.num.len()); |
2083 | 0 | num.slice_mut().clone_from_slice(self.num.slice()); |
2084 | 0 | let mut buckets = allocate::<u32, _>(m, self.buckets.len()); |
2085 | 0 | buckets.slice_mut().clone_from_slice(self.buckets.slice()); |
2086 | 0 | AdvHasher::<Special, Alloc> { |
2087 | 0 | GetHasherCommon: self.GetHasherCommon.clone(), |
2088 | 0 | specialization: self.specialization.clone(), |
2089 | 0 | num, |
2090 | 0 | buckets, |
2091 | 0 | h9_opts: self.h9_opts, |
2092 | 0 | } |
2093 | 0 | } |
2094 | | } |
2095 | | |
2096 | | pub enum UnionHasher<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> { |
2097 | | Uninit, |
2098 | | H2(BasicHasher<H2Sub<Alloc>>), |
2099 | | H3(BasicHasher<H3Sub<Alloc>>), |
2100 | | H4(BasicHasher<H4Sub<Alloc>>), |
2101 | | H54(BasicHasher<H54Sub<Alloc>>), |
2102 | | H5(AdvHasher<H5Sub, Alloc>), |
2103 | | H5q7(AdvHasher<HQ7Sub, Alloc>), |
2104 | | H5q5(AdvHasher<HQ5Sub, Alloc>), |
2105 | | H6(AdvHasher<H6Sub, Alloc>), |
2106 | | H9(H9<Alloc>), |
2107 | | H10(H10<Alloc, H10Buckets<Alloc>, H10DefaultParams>), |
2108 | | } |
2109 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> PartialEq<UnionHasher<Alloc>> |
2110 | | for UnionHasher<Alloc> |
2111 | | { |
2112 | 0 | fn eq(&self, other: &UnionHasher<Alloc>) -> bool { |
2113 | 0 | match *self { |
2114 | 0 | UnionHasher::H2(ref hasher) => match *other { |
2115 | 0 | UnionHasher::H2(ref otherh) => *hasher == *otherh, |
2116 | 0 | _ => false, |
2117 | | }, |
2118 | 0 | UnionHasher::H3(ref hasher) => match *other { |
2119 | 0 | UnionHasher::H3(ref otherh) => *hasher == *otherh, |
2120 | 0 | _ => false, |
2121 | | }, |
2122 | 0 | UnionHasher::H4(ref hasher) => match *other { |
2123 | 0 | UnionHasher::H4(ref otherh) => *hasher == *otherh, |
2124 | 0 | _ => false, |
2125 | | }, |
2126 | 0 | UnionHasher::H54(ref hasher) => match *other { |
2127 | 0 | UnionHasher::H54(ref otherh) => *hasher == *otherh, |
2128 | 0 | _ => false, |
2129 | | }, |
2130 | 0 | UnionHasher::H5(ref hasher) => match *other { |
2131 | 0 | UnionHasher::H5(ref otherh) => *hasher == *otherh, |
2132 | 0 | _ => false, |
2133 | | }, |
2134 | 0 | UnionHasher::H5q7(ref hasher) => match *other { |
2135 | 0 | UnionHasher::H5q7(ref otherh) => *hasher == *otherh, |
2136 | 0 | _ => false, |
2137 | | }, |
2138 | 0 | UnionHasher::H5q5(ref hasher) => match *other { |
2139 | 0 | UnionHasher::H5q5(ref otherh) => *hasher == *otherh, |
2140 | 0 | _ => false, |
2141 | | }, |
2142 | 0 | UnionHasher::H6(ref hasher) => match *other { |
2143 | 0 | UnionHasher::H6(ref otherh) => *hasher == *otherh, |
2144 | 0 | _ => false, |
2145 | | }, |
2146 | 0 | UnionHasher::H9(ref hasher) => match *other { |
2147 | 0 | UnionHasher::H9(ref otherh) => *hasher == *otherh, |
2148 | 0 | _ => false, |
2149 | | }, |
2150 | 0 | UnionHasher::H10(ref hasher) => match *other { |
2151 | 0 | UnionHasher::H10(ref otherh) => *hasher == *otherh, |
2152 | 0 | _ => false, |
2153 | | }, |
2154 | 0 | UnionHasher::Uninit => match *other { |
2155 | 0 | UnionHasher::Uninit => true, |
2156 | 0 | _ => false, |
2157 | | }, |
2158 | | } |
2159 | 0 | } |
2160 | | } |
2161 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> CloneWithAlloc<Alloc> |
2162 | | for UnionHasher<Alloc> |
2163 | | { |
2164 | 0 | fn clone_with_alloc(&self, m: &mut Alloc) -> Self { |
2165 | 0 | match *self { |
2166 | 0 | UnionHasher::H2(ref hasher) => UnionHasher::H2(hasher.clone_with_alloc(m)), |
2167 | 0 | UnionHasher::H3(ref hasher) => UnionHasher::H3(hasher.clone_with_alloc(m)), |
2168 | 0 | UnionHasher::H4(ref hasher) => UnionHasher::H4(hasher.clone_with_alloc(m)), |
2169 | 0 | UnionHasher::H5(ref hasher) => UnionHasher::H5(hasher.clone_with_alloc(m)), |
2170 | 0 | UnionHasher::H5q7(ref hasher) => UnionHasher::H5q7(hasher.clone_with_alloc(m)), |
2171 | 0 | UnionHasher::H5q5(ref hasher) => UnionHasher::H5q5(hasher.clone_with_alloc(m)), |
2172 | 0 | UnionHasher::H6(ref hasher) => UnionHasher::H6(hasher.clone_with_alloc(m)), |
2173 | 0 | UnionHasher::H54(ref hasher) => UnionHasher::H54(hasher.clone_with_alloc(m)), |
2174 | 0 | UnionHasher::H9(ref hasher) => UnionHasher::H9(hasher.clone_with_alloc(m)), |
2175 | 0 | UnionHasher::H10(ref hasher) => UnionHasher::H10(hasher.clone_with_alloc(m)), |
2176 | 0 | UnionHasher::Uninit => UnionHasher::Uninit, |
2177 | | } |
2178 | 0 | } |
2179 | | } |
2180 | | macro_rules! match_all_hashers_mut { |
2181 | | ($xself : expr, $func_call : ident, $( $args:expr),*) => { |
2182 | | match $xself { |
2183 | | &mut UnionHasher::H2(ref mut hasher) => hasher.$func_call($($args),*), |
2184 | | &mut UnionHasher::H3(ref mut hasher) => hasher.$func_call($($args),*), |
2185 | | &mut UnionHasher::H4(ref mut hasher) => hasher.$func_call($($args),*), |
2186 | | &mut UnionHasher::H5(ref mut hasher) => hasher.$func_call($($args),*), |
2187 | | &mut UnionHasher::H5q7(ref mut hasher) => hasher.$func_call($($args),*), |
2188 | | &mut UnionHasher::H5q5(ref mut hasher) => hasher.$func_call($($args),*), |
2189 | | &mut UnionHasher::H6(ref mut hasher) => hasher.$func_call($($args),*), |
2190 | | &mut UnionHasher::H54(ref mut hasher) => hasher.$func_call($($args),*), |
2191 | | &mut UnionHasher::H9(ref mut hasher) => hasher.$func_call($($args),*), |
2192 | | &mut UnionHasher::H10(ref mut hasher) => hasher.$func_call($($args),*), |
2193 | | &mut UnionHasher::Uninit => panic!("UNINTIALIZED"), |
2194 | | } |
2195 | | }; |
2196 | | } |
2197 | | macro_rules! match_all_hashers { |
2198 | | ($xself : expr, $func_call : ident, $( $args:expr),*) => { |
2199 | | match $xself { |
2200 | | &UnionHasher::H2(ref hasher) => hasher.$func_call($($args),*), |
2201 | | &UnionHasher::H3(ref hasher) => hasher.$func_call($($args),*), |
2202 | | &UnionHasher::H4(ref hasher) => hasher.$func_call($($args),*), |
2203 | | &UnionHasher::H5(ref hasher) => hasher.$func_call($($args),*), |
2204 | | &UnionHasher::H5q7(ref hasher) => hasher.$func_call($($args),*), |
2205 | | &UnionHasher::H5q5(ref hasher) => hasher.$func_call($($args),*), |
2206 | | &UnionHasher::H6(ref hasher) => hasher.$func_call($($args),*), |
2207 | | &UnionHasher::H54(ref hasher) => hasher.$func_call($($args),*), |
2208 | | &UnionHasher::H9(ref hasher) => hasher.$func_call($($args),*), |
2209 | | &UnionHasher::H10(ref hasher) => hasher.$func_call($($args),*), |
2210 | | &UnionHasher::Uninit => panic!("UNINTIALIZED"), |
2211 | | } |
2212 | | }; |
2213 | | } |
2214 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for UnionHasher<Alloc> { |
2215 | 0 | fn Opts(&self) -> H9Opts { |
2216 | 0 | match_all_hashers!(self, Opts,) |
2217 | 0 | } |
2218 | 32.7k | fn GetHasherCommon(&mut self) -> &mut Struct1 { |
2219 | 32.7k | match_all_hashers_mut!(self, GetHasherCommon,) |
2220 | 32.7k | } /* <brotli::enc::backward_references::UnionHasher<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon Line | Count | Source | 2218 | 32.7k | fn GetHasherCommon(&mut self) -> &mut Struct1 { | 2219 | 32.7k | match_all_hashers_mut!(self, GetHasherCommon,) | 2220 | 32.7k | } /* |
Unexecuted instantiation: <brotli::enc::backward_references::UnionHasher<_> as brotli::enc::backward_references::AnyHasher>::GetHasherCommon |
2221 | | fn GetH10Tree(&mut self) -> Option<&mut H10<AllocU32, H10Buckets, H10DefaultParams>> { |
2222 | | return match_all_hashers_mut!(self, GetH10Tree,); |
2223 | | }*/ |
2224 | 4.51k | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { |
2225 | 4.51k | match_all_hashers_mut!(self, Prepare, one_shot, input_size, data) |
2226 | 4.51k | } <brotli::enc::backward_references::UnionHasher<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::Prepare Line | Count | Source | 2224 | 4.51k | fn Prepare(&mut self, one_shot: bool, input_size: usize, data: &[u8]) -> HowPrepared { | 2225 | 4.51k | match_all_hashers_mut!(self, Prepare, one_shot, input_size, data) | 2226 | 4.51k | } |
Unexecuted instantiation: <brotli::enc::backward_references::UnionHasher<_> as brotli::enc::backward_references::AnyHasher>::Prepare |
2227 | 0 | fn HashBytes(&self, data: &[u8]) -> usize { |
2228 | 0 | match_all_hashers!(self, HashBytes, data) |
2229 | 0 | } |
2230 | 0 | fn HashTypeLength(&self) -> usize { |
2231 | 0 | match_all_hashers!(self, HashTypeLength,) |
2232 | 0 | } |
2233 | 0 | fn StoreLookahead(&self) -> usize { |
2234 | 0 | match_all_hashers!(self, StoreLookahead,) |
2235 | 0 | } |
2236 | 0 | fn PrepareDistanceCache(&self, distance_cache: &mut [i32]) { |
2237 | 0 | match_all_hashers!(self, PrepareDistanceCache, distance_cache) |
2238 | 0 | } |
2239 | 15.4k | fn StitchToPreviousBlock( |
2240 | 15.4k | &mut self, |
2241 | 15.4k | num_bytes: usize, |
2242 | 15.4k | position: usize, |
2243 | 15.4k | ringbuffer: &[u8], |
2244 | 15.4k | ringbuffer_mask: usize, |
2245 | 15.4k | ) { |
2246 | 7.52k | match_all_hashers_mut!( |
2247 | 15.4k | self, |
2248 | | StitchToPreviousBlock, |
2249 | 2.08k | num_bytes, |
2250 | 2.08k | position, |
2251 | 2.08k | ringbuffer, |
2252 | 2.08k | ringbuffer_mask |
2253 | | ) |
2254 | 15.4k | } <brotli::enc::backward_references::UnionHasher<alloc_stdlib::std_alloc::StandardAlloc> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock Line | Count | Source | 2239 | 15.4k | fn StitchToPreviousBlock( | 2240 | 15.4k | &mut self, | 2241 | 15.4k | num_bytes: usize, | 2242 | 15.4k | position: usize, | 2243 | 15.4k | ringbuffer: &[u8], | 2244 | 15.4k | ringbuffer_mask: usize, | 2245 | 15.4k | ) { | 2246 | 7.52k | match_all_hashers_mut!( | 2247 | 15.4k | self, | 2248 | | StitchToPreviousBlock, | 2249 | 2.08k | num_bytes, | 2250 | 2.08k | position, | 2251 | 2.08k | ringbuffer, | 2252 | 2.08k | ringbuffer_mask | 2253 | | ) | 2254 | 15.4k | } |
Unexecuted instantiation: <brotli::enc::backward_references::UnionHasher<_> as brotli::enc::backward_references::AnyHasher>::StitchToPreviousBlock |
2255 | 0 | fn FindLongestMatch( |
2256 | 0 | &mut self, |
2257 | 0 | dictionary: Option<&BrotliDictionary>, |
2258 | 0 | dictionary_hash: &[u16], |
2259 | 0 | data: &[u8], |
2260 | 0 | ring_buffer_mask: usize, |
2261 | 0 | ring_buffer_break: Option<core::num::NonZeroUsize>, |
2262 | 0 | distance_cache: &[i32], |
2263 | 0 | cur_ix: usize, |
2264 | 0 | max_length: usize, |
2265 | 0 | max_backward: usize, |
2266 | 0 | gap: usize, |
2267 | 0 | max_distance: usize, |
2268 | 0 | out: &mut HasherSearchResult, |
2269 | 0 | ) -> bool { |
2270 | 0 | match_all_hashers_mut!( |
2271 | 0 | self, |
2272 | | FindLongestMatch, |
2273 | 0 | dictionary, |
2274 | 0 | dictionary_hash, |
2275 | 0 | data, |
2276 | 0 | ring_buffer_mask, |
2277 | 0 | ring_buffer_break, |
2278 | 0 | distance_cache, |
2279 | 0 | cur_ix, |
2280 | 0 | max_length, |
2281 | 0 | max_backward, |
2282 | 0 | gap, |
2283 | 0 | max_distance, |
2284 | 0 | out |
2285 | | ) |
2286 | 0 | } |
2287 | 0 | fn Store(&mut self, data: &[u8], mask: usize, ix: usize) { |
2288 | 0 | match_all_hashers_mut!(self, Store, data, mask, ix) |
2289 | 0 | } |
2290 | 0 | fn StoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { |
2291 | 0 | match_all_hashers_mut!(self, StoreRange, data, mask, ix_start, ix_end) |
2292 | 0 | } |
2293 | 0 | fn BulkStoreRange(&mut self, data: &[u8], mask: usize, ix_start: usize, ix_end: usize) { |
2294 | 0 | match_all_hashers_mut!(self, BulkStoreRange, data, mask, ix_start, ix_end) |
2295 | 0 | } |
2296 | | } |
2297 | | |
2298 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> UnionHasher<Alloc> { |
2299 | 12.2k | pub fn free(&mut self, alloc: &mut Alloc) { |
2300 | 12.2k | match self { |
2301 | 636 | &mut UnionHasher::H2(ref mut hasher) => { |
2302 | 636 | <Alloc as Allocator<u32>>::free_cell( |
2303 | 636 | alloc, |
2304 | 636 | core::mem::take(&mut hasher.buckets_.buckets_), |
2305 | 636 | ); |
2306 | 636 | } |
2307 | 526 | &mut UnionHasher::H3(ref mut hasher) => { |
2308 | 526 | <Alloc as Allocator<u32>>::free_cell( |
2309 | 526 | alloc, |
2310 | 526 | core::mem::take(&mut hasher.buckets_.buckets_), |
2311 | 526 | ); |
2312 | 526 | } |
2313 | 585 | &mut UnionHasher::H4(ref mut hasher) => { |
2314 | 585 | <Alloc as Allocator<u32>>::free_cell( |
2315 | 585 | alloc, |
2316 | 585 | core::mem::take(&mut hasher.buckets_.buckets_), |
2317 | 585 | ); |
2318 | 585 | } |
2319 | 0 | &mut UnionHasher::H54(ref mut hasher) => { |
2320 | 0 | <Alloc as Allocator<u32>>::free_cell( |
2321 | 0 | alloc, |
2322 | 0 | core::mem::take(&mut hasher.buckets_.buckets_), |
2323 | 0 | ); |
2324 | 0 | } |
2325 | 528 | &mut UnionHasher::H5q7(ref mut hasher) => { |
2326 | 528 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); |
2327 | 528 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); |
2328 | 528 | } |
2329 | 634 | &mut UnionHasher::H5q5(ref mut hasher) => { |
2330 | 634 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); |
2331 | 634 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); |
2332 | 634 | } |
2333 | 646 | &mut UnionHasher::H5(ref mut hasher) => { |
2334 | 646 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); |
2335 | 646 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); |
2336 | 646 | } |
2337 | 840 | &mut UnionHasher::H6(ref mut hasher) => { |
2338 | 840 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); |
2339 | 840 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); |
2340 | 840 | } |
2341 | 550 | &mut UnionHasher::H9(ref mut hasher) => { |
2342 | 550 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num_)); |
2343 | 550 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets_)); |
2344 | 550 | } |
2345 | 5.97k | &mut UnionHasher::H10(ref mut hasher) => { |
2346 | 5.97k | hasher.free(alloc); |
2347 | 5.97k | } |
2348 | 1.37k | &mut UnionHasher::Uninit => {} |
2349 | | } |
2350 | 12.2k | *self = UnionHasher::<Alloc>::default(); |
2351 | 12.2k | } <brotli::enc::backward_references::UnionHasher<alloc_stdlib::std_alloc::StandardAlloc>>::free Line | Count | Source | 2299 | 12.2k | pub fn free(&mut self, alloc: &mut Alloc) { | 2300 | 12.2k | match self { | 2301 | 636 | &mut UnionHasher::H2(ref mut hasher) => { | 2302 | 636 | <Alloc as Allocator<u32>>::free_cell( | 2303 | 636 | alloc, | 2304 | 636 | core::mem::take(&mut hasher.buckets_.buckets_), | 2305 | 636 | ); | 2306 | 636 | } | 2307 | 526 | &mut UnionHasher::H3(ref mut hasher) => { | 2308 | 526 | <Alloc as Allocator<u32>>::free_cell( | 2309 | 526 | alloc, | 2310 | 526 | core::mem::take(&mut hasher.buckets_.buckets_), | 2311 | 526 | ); | 2312 | 526 | } | 2313 | 585 | &mut UnionHasher::H4(ref mut hasher) => { | 2314 | 585 | <Alloc as Allocator<u32>>::free_cell( | 2315 | 585 | alloc, | 2316 | 585 | core::mem::take(&mut hasher.buckets_.buckets_), | 2317 | 585 | ); | 2318 | 585 | } | 2319 | 0 | &mut UnionHasher::H54(ref mut hasher) => { | 2320 | 0 | <Alloc as Allocator<u32>>::free_cell( | 2321 | 0 | alloc, | 2322 | 0 | core::mem::take(&mut hasher.buckets_.buckets_), | 2323 | 0 | ); | 2324 | 0 | } | 2325 | 528 | &mut UnionHasher::H5q7(ref mut hasher) => { | 2326 | 528 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); | 2327 | 528 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); | 2328 | 528 | } | 2329 | 634 | &mut UnionHasher::H5q5(ref mut hasher) => { | 2330 | 634 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); | 2331 | 634 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); | 2332 | 634 | } | 2333 | 646 | &mut UnionHasher::H5(ref mut hasher) => { | 2334 | 646 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); | 2335 | 646 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); | 2336 | 646 | } | 2337 | 840 | &mut UnionHasher::H6(ref mut hasher) => { | 2338 | 840 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num)); | 2339 | 840 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets)); | 2340 | 840 | } | 2341 | 550 | &mut UnionHasher::H9(ref mut hasher) => { | 2342 | 550 | <Alloc as Allocator<u16>>::free_cell(alloc, core::mem::take(&mut hasher.num_)); | 2343 | 550 | <Alloc as Allocator<u32>>::free_cell(alloc, core::mem::take(&mut hasher.buckets_)); | 2344 | 550 | } | 2345 | 5.97k | &mut UnionHasher::H10(ref mut hasher) => { | 2346 | 5.97k | hasher.free(alloc); | 2347 | 5.97k | } | 2348 | 1.37k | &mut UnionHasher::Uninit => {} | 2349 | | } | 2350 | 12.2k | *self = UnionHasher::<Alloc>::default(); | 2351 | 12.2k | } |
Unexecuted instantiation: <brotli::enc::backward_references::UnionHasher<_>>::free |
2352 | | } |
2353 | | |
2354 | | impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> Default for UnionHasher<Alloc> { |
2355 | 24.5k | fn default() -> Self { |
2356 | 24.5k | UnionHasher::Uninit |
2357 | 24.5k | } <brotli::enc::backward_references::UnionHasher<alloc_stdlib::std_alloc::StandardAlloc> as core::default::Default>::default Line | Count | Source | 2355 | 24.5k | fn default() -> Self { | 2356 | 24.5k | UnionHasher::Uninit | 2357 | 24.5k | } |
Unexecuted instantiation: <brotli::enc::backward_references::UnionHasher<_> as core::default::Default>::default |
2358 | | } |
2359 | | |
2360 | | /*UnionHasher::H2(BasicHasher { |
2361 | | GetHasherCommon:Struct1{params:BrotliHasherParams{ |
2362 | | type_:2, |
2363 | | block_bits: 8, |
2364 | | bucket_bits:16, |
2365 | | hash_len: 4, |
2366 | | num_last_distances_to_check:0}, |
2367 | | is_prepared_:0, |
2368 | | dict_num_lookups:0, |
2369 | | dict_num_matches:0, |
2370 | | }, |
2371 | | buckets_:H2Sub{ |
2372 | | buckets_:[0;65537], |
2373 | | }, |
2374 | | }) |
2375 | | */ |
2376 | 7.90k | fn CreateBackwardReferences<AH: AnyHasher>( |
2377 | 7.90k | dictionary: Option<&BrotliDictionary>, |
2378 | 7.90k | dictionary_hash: &[u16], |
2379 | 7.90k | num_bytes: usize, |
2380 | 7.90k | mut position: usize, |
2381 | 7.90k | ringbuffer: &[u8], |
2382 | 7.90k | ringbuffer_mask: usize, |
2383 | 7.90k | ringbuffer_break: Option<core::num::NonZeroUsize>, |
2384 | 7.90k | params: &BrotliEncoderParams, |
2385 | 7.90k | hasher: &mut AH, |
2386 | 7.90k | dist_cache: &mut [i32], |
2387 | 7.90k | last_insert_len: &mut usize, |
2388 | 7.90k | mut commands: &mut [Command], |
2389 | 7.90k | num_commands: &mut usize, |
2390 | 7.90k | num_literals: &mut usize, |
2391 | 7.90k | ) { |
2392 | 7.90k | let gap = 0usize; |
2393 | 7.90k | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); |
2394 | 7.90k | let mut new_commands_count: usize = 0; |
2395 | 7.90k | let mut insert_length: usize = *last_insert_len; |
2396 | 7.90k | let pos_end: usize = position.wrapping_add(num_bytes); |
2397 | 7.90k | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { |
2398 | 7.47k | position |
2399 | 7.47k | .wrapping_add(num_bytes) |
2400 | 7.47k | .wrapping_sub(hasher.StoreLookahead()) |
2401 | 7.47k | .wrapping_add(1) |
2402 | | } else { |
2403 | 424 | position |
2404 | | }; |
2405 | 7.90k | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); |
2406 | 7.90k | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); |
2407 | 7.90k | let kMinScore: u64 = (30u64 * 8) |
2408 | 7.90k | .wrapping_mul(::core::mem::size_of::<u64>() as u64) |
2409 | 7.90k | .wrapping_add(100); |
2410 | 7.90k | hasher.PrepareDistanceCache(dist_cache); |
2411 | 9.94M | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { |
2412 | 9.94M | let mut max_length: usize = pos_end.wrapping_sub(position); |
2413 | 9.94M | let mut max_distance: usize = min(position, max_backward_limit); |
2414 | 9.94M | let mut sr = HasherSearchResult { |
2415 | 9.94M | len: 0, |
2416 | 9.94M | len_x_code: 0, |
2417 | 9.94M | distance: 0, |
2418 | 9.94M | score: 0, |
2419 | 9.94M | }; |
2420 | 9.94M | sr.len = 0usize; |
2421 | 9.94M | sr.len_x_code = 0usize; |
2422 | 9.94M | sr.distance = 0usize; |
2423 | 9.94M | sr.score = kMinScore; |
2424 | 9.94M | if hasher.FindLongestMatch( |
2425 | 9.94M | dictionary, |
2426 | 9.94M | dictionary_hash, |
2427 | 9.94M | ringbuffer, |
2428 | 9.94M | ringbuffer_mask, |
2429 | 9.94M | ringbuffer_break, |
2430 | 9.94M | dist_cache, |
2431 | 9.94M | position, |
2432 | 9.94M | max_length, |
2433 | 9.94M | max_distance, |
2434 | 9.94M | gap, |
2435 | 9.94M | params.dist.max_distance, |
2436 | 9.94M | &mut sr, |
2437 | | ) { |
2438 | 1.82M | let mut delayed_backward_references_in_row: i32 = 0i32; |
2439 | 1.82M | max_length = max_length.wrapping_sub(1); |
2440 | | 'break6: loop { |
2441 | | 'continue7: loop { |
2442 | 2.06M | let cost_diff_lazy: u64 = 175; |
2443 | | |
2444 | 2.06M | let mut sr2 = HasherSearchResult { |
2445 | 2.06M | len: 0, |
2446 | 2.06M | len_x_code: 0, |
2447 | 2.06M | distance: 0, |
2448 | 2.06M | score: 0, |
2449 | 2.06M | }; |
2450 | 2.06M | sr2.len = if params.quality < 5 { |
2451 | 885k | min(sr.len.wrapping_sub(1), max_length) |
2452 | | } else { |
2453 | 1.18M | 0usize |
2454 | | }; |
2455 | 2.06M | sr2.len_x_code = 0usize; |
2456 | 2.06M | sr2.distance = 0usize; |
2457 | 2.06M | sr2.score = kMinScore; |
2458 | 2.06M | max_distance = min(position.wrapping_add(1), max_backward_limit); |
2459 | 2.06M | let is_match_found: bool = hasher.FindLongestMatch( |
2460 | 2.06M | dictionary, |
2461 | 2.06M | dictionary_hash, |
2462 | 2.06M | ringbuffer, |
2463 | 2.06M | ringbuffer_mask, |
2464 | 2.06M | ringbuffer_break, |
2465 | 2.06M | dist_cache, |
2466 | 2.06M | position.wrapping_add(1), |
2467 | 2.06M | max_length, |
2468 | 2.06M | max_distance, |
2469 | 2.06M | gap, |
2470 | 2.06M | params.dist.max_distance, |
2471 | 2.06M | &mut sr2, |
2472 | | ); |
2473 | 2.06M | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { |
2474 | 245k | position = position.wrapping_add(1); |
2475 | 245k | insert_length = insert_length.wrapping_add(1); |
2476 | 245k | sr = sr2; |
2477 | 245k | if { |
2478 | 245k | delayed_backward_references_in_row += 1; |
2479 | 245k | delayed_backward_references_in_row |
2480 | 245k | } < 4i32 |
2481 | 244k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) |
2482 | | { |
2483 | 244k | break 'continue7; |
2484 | 109 | } |
2485 | 1.82M | } |
2486 | 1.82M | break 'break6; |
2487 | | } |
2488 | 244k | max_length = max_length.wrapping_sub(1); |
2489 | | } |
2490 | 1.82M | apply_random_heuristics = position |
2491 | 1.82M | .wrapping_add((2usize).wrapping_mul(sr.len)) |
2492 | 1.82M | .wrapping_add(random_heuristics_window_size); |
2493 | 1.82M | max_distance = min(position, max_backward_limit); |
2494 | | { |
2495 | 1.82M | let distance_code: usize = |
2496 | 1.82M | ComputeDistanceCode(sr.distance, max_distance, dist_cache); |
2497 | 1.82M | if sr.distance <= max_distance && (distance_code > 0usize) { |
2498 | 1.26M | dist_cache[3] = dist_cache[2]; |
2499 | 1.26M | dist_cache[2] = dist_cache[1]; |
2500 | 1.26M | dist_cache[1] = dist_cache[0]; |
2501 | 1.26M | dist_cache[0] = sr.distance as i32; |
2502 | 1.26M | hasher.PrepareDistanceCache(dist_cache); |
2503 | 1.26M | } |
2504 | 1.82M | new_commands_count += 1; |
2505 | | |
2506 | 1.82M | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); |
2507 | 1.82M | commands = new_commands; |
2508 | 1.82M | old[0].init( |
2509 | 1.82M | ¶ms.dist, |
2510 | 1.82M | insert_length, |
2511 | 1.82M | sr.len, |
2512 | 1.82M | sr.len ^ sr.len_x_code, |
2513 | 1.82M | distance_code, |
2514 | | ); |
2515 | | } |
2516 | 1.82M | *num_literals = num_literals.wrapping_add(insert_length); |
2517 | 1.82M | insert_length = 0usize; |
2518 | 1.82M | hasher.StoreRange( |
2519 | 1.82M | ringbuffer, |
2520 | 1.82M | ringbuffer_mask, |
2521 | 1.82M | position.wrapping_add(2), |
2522 | 1.82M | min(position.wrapping_add(sr.len), store_end), |
2523 | | ); |
2524 | 1.82M | position = position.wrapping_add(sr.len); |
2525 | | } else { |
2526 | 8.11M | insert_length = insert_length.wrapping_add(1); |
2527 | 8.11M | position = position.wrapping_add(1); |
2528 | | |
2529 | 8.11M | if position > apply_random_heuristics { |
2530 | 1.19M | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); |
2531 | 1.19M | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { |
2532 | 839 | insert_length = insert_length.wrapping_add(pos_end - position); |
2533 | 839 | position = pos_end; |
2534 | 1.19M | } else if position |
2535 | 1.19M | > apply_random_heuristics |
2536 | 1.19M | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) |
2537 | 880k | { |
2538 | 880k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); |
2539 | 880k | insert_length = insert_length.wrapping_add(16); |
2540 | 880k | position = position.wrapping_add(16); |
2541 | 880k | } else { |
2542 | 313k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); |
2543 | 313k | insert_length = insert_length.wrapping_add(8); |
2544 | 313k | position = position.wrapping_add(8); |
2545 | 313k | } |
2546 | 6.92M | } |
2547 | | } |
2548 | | } |
2549 | 7.90k | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); |
2550 | 7.90k | *last_insert_len = insert_length; |
2551 | 7.90k | *num_commands = num_commands.wrapping_add(new_commands_count); |
2552 | 7.90k | } brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H2Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 2376 | 2.08k | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 2.08k | dictionary: Option<&BrotliDictionary>, | 2378 | 2.08k | dictionary_hash: &[u16], | 2379 | 2.08k | num_bytes: usize, | 2380 | 2.08k | mut position: usize, | 2381 | 2.08k | ringbuffer: &[u8], | 2382 | 2.08k | ringbuffer_mask: usize, | 2383 | 2.08k | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 2.08k | params: &BrotliEncoderParams, | 2385 | 2.08k | hasher: &mut AH, | 2386 | 2.08k | dist_cache: &mut [i32], | 2387 | 2.08k | last_insert_len: &mut usize, | 2388 | 2.08k | mut commands: &mut [Command], | 2389 | 2.08k | num_commands: &mut usize, | 2390 | 2.08k | num_literals: &mut usize, | 2391 | 2.08k | ) { | 2392 | 2.08k | let gap = 0usize; | 2393 | 2.08k | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 2.08k | let mut new_commands_count: usize = 0; | 2395 | 2.08k | let mut insert_length: usize = *last_insert_len; | 2396 | 2.08k | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 2.08k | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 1.88k | position | 2399 | 1.88k | .wrapping_add(num_bytes) | 2400 | 1.88k | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 1.88k | .wrapping_add(1) | 2402 | | } else { | 2403 | 205 | position | 2404 | | }; | 2405 | 2.08k | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 2.08k | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 2.08k | let kMinScore: u64 = (30u64 * 8) | 2408 | 2.08k | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 2.08k | .wrapping_add(100); | 2410 | 2.08k | hasher.PrepareDistanceCache(dist_cache); | 2411 | 2.31M | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 2.30M | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 2.30M | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 2.30M | let mut sr = HasherSearchResult { | 2415 | 2.30M | len: 0, | 2416 | 2.30M | len_x_code: 0, | 2417 | 2.30M | distance: 0, | 2418 | 2.30M | score: 0, | 2419 | 2.30M | }; | 2420 | 2.30M | sr.len = 0usize; | 2421 | 2.30M | sr.len_x_code = 0usize; | 2422 | 2.30M | sr.distance = 0usize; | 2423 | 2.30M | sr.score = kMinScore; | 2424 | 2.30M | if hasher.FindLongestMatch( | 2425 | 2.30M | dictionary, | 2426 | 2.30M | dictionary_hash, | 2427 | 2.30M | ringbuffer, | 2428 | 2.30M | ringbuffer_mask, | 2429 | 2.30M | ringbuffer_break, | 2430 | 2.30M | dist_cache, | 2431 | 2.30M | position, | 2432 | 2.30M | max_length, | 2433 | 2.30M | max_distance, | 2434 | 2.30M | gap, | 2435 | 2.30M | params.dist.max_distance, | 2436 | 2.30M | &mut sr, | 2437 | | ) { | 2438 | 387k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 387k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 444k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 444k | let mut sr2 = HasherSearchResult { | 2445 | 444k | len: 0, | 2446 | 444k | len_x_code: 0, | 2447 | 444k | distance: 0, | 2448 | 444k | score: 0, | 2449 | 444k | }; | 2450 | 444k | sr2.len = if params.quality < 5 { | 2451 | 444k | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 0 | 0usize | 2454 | | }; | 2455 | 444k | sr2.len_x_code = 0usize; | 2456 | 444k | sr2.distance = 0usize; | 2457 | 444k | sr2.score = kMinScore; | 2458 | 444k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 444k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 444k | dictionary, | 2461 | 444k | dictionary_hash, | 2462 | 444k | ringbuffer, | 2463 | 444k | ringbuffer_mask, | 2464 | 444k | ringbuffer_break, | 2465 | 444k | dist_cache, | 2466 | 444k | position.wrapping_add(1), | 2467 | 444k | max_length, | 2468 | 444k | max_distance, | 2469 | 444k | gap, | 2470 | 444k | params.dist.max_distance, | 2471 | 444k | &mut sr2, | 2472 | | ); | 2473 | 444k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 57.9k | position = position.wrapping_add(1); | 2475 | 57.9k | insert_length = insert_length.wrapping_add(1); | 2476 | 57.9k | sr = sr2; | 2477 | 57.9k | if { | 2478 | 57.9k | delayed_backward_references_in_row += 1; | 2479 | 57.9k | delayed_backward_references_in_row | 2480 | 57.9k | } < 4i32 | 2481 | 57.9k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 57.9k | break 'continue7; | 2484 | 18 | } | 2485 | 387k | } | 2486 | 387k | break 'break6; | 2487 | | } | 2488 | 57.9k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 387k | apply_random_heuristics = position | 2491 | 387k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 387k | .wrapping_add(random_heuristics_window_size); | 2493 | 387k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 387k | let distance_code: usize = | 2496 | 387k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 387k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 289k | dist_cache[3] = dist_cache[2]; | 2499 | 289k | dist_cache[2] = dist_cache[1]; | 2500 | 289k | dist_cache[1] = dist_cache[0]; | 2501 | 289k | dist_cache[0] = sr.distance as i32; | 2502 | 289k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 289k | } | 2504 | 387k | new_commands_count += 1; | 2505 | | | 2506 | 387k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 387k | commands = new_commands; | 2508 | 387k | old[0].init( | 2509 | 387k | ¶ms.dist, | 2510 | 387k | insert_length, | 2511 | 387k | sr.len, | 2512 | 387k | sr.len ^ sr.len_x_code, | 2513 | 387k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 387k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 387k | insert_length = 0usize; | 2518 | 387k | hasher.StoreRange( | 2519 | 387k | ringbuffer, | 2520 | 387k | ringbuffer_mask, | 2521 | 387k | position.wrapping_add(2), | 2522 | 387k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 387k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 1.92M | insert_length = insert_length.wrapping_add(1); | 2527 | 1.92M | position = position.wrapping_add(1); | 2528 | | | 2529 | 1.92M | if position > apply_random_heuristics { | 2530 | 299k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 299k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 319 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 319 | position = pos_end; | 2534 | 299k | } else if position | 2535 | 299k | > apply_random_heuristics | 2536 | 299k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 242k | { | 2538 | 242k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 242k | insert_length = insert_length.wrapping_add(16); | 2540 | 242k | position = position.wrapping_add(16); | 2541 | 242k | } else { | 2542 | 56.8k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 56.8k | insert_length = insert_length.wrapping_add(8); | 2544 | 56.8k | position = position.wrapping_add(8); | 2545 | 56.8k | } | 2546 | 1.62M | } | 2547 | | } | 2548 | | } | 2549 | 2.08k | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 2.08k | *last_insert_len = insert_length; | 2551 | 2.08k | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 2.08k | } |
brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H3Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 2376 | 1.29k | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 1.29k | dictionary: Option<&BrotliDictionary>, | 2378 | 1.29k | dictionary_hash: &[u16], | 2379 | 1.29k | num_bytes: usize, | 2380 | 1.29k | mut position: usize, | 2381 | 1.29k | ringbuffer: &[u8], | 2382 | 1.29k | ringbuffer_mask: usize, | 2383 | 1.29k | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 1.29k | params: &BrotliEncoderParams, | 2385 | 1.29k | hasher: &mut AH, | 2386 | 1.29k | dist_cache: &mut [i32], | 2387 | 1.29k | last_insert_len: &mut usize, | 2388 | 1.29k | mut commands: &mut [Command], | 2389 | 1.29k | num_commands: &mut usize, | 2390 | 1.29k | num_literals: &mut usize, | 2391 | 1.29k | ) { | 2392 | 1.29k | let gap = 0usize; | 2393 | 1.29k | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 1.29k | let mut new_commands_count: usize = 0; | 2395 | 1.29k | let mut insert_length: usize = *last_insert_len; | 2396 | 1.29k | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 1.29k | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 1.16k | position | 2399 | 1.16k | .wrapping_add(num_bytes) | 2400 | 1.16k | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 1.16k | .wrapping_add(1) | 2402 | | } else { | 2403 | 124 | position | 2404 | | }; | 2405 | 1.29k | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 1.29k | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 1.29k | let kMinScore: u64 = (30u64 * 8) | 2408 | 1.29k | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 1.29k | .wrapping_add(100); | 2410 | 1.29k | hasher.PrepareDistanceCache(dist_cache); | 2411 | 1.02M | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 1.02M | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 1.02M | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 1.02M | let mut sr = HasherSearchResult { | 2415 | 1.02M | len: 0, | 2416 | 1.02M | len_x_code: 0, | 2417 | 1.02M | distance: 0, | 2418 | 1.02M | score: 0, | 2419 | 1.02M | }; | 2420 | 1.02M | sr.len = 0usize; | 2421 | 1.02M | sr.len_x_code = 0usize; | 2422 | 1.02M | sr.distance = 0usize; | 2423 | 1.02M | sr.score = kMinScore; | 2424 | 1.02M | if hasher.FindLongestMatch( | 2425 | 1.02M | dictionary, | 2426 | 1.02M | dictionary_hash, | 2427 | 1.02M | ringbuffer, | 2428 | 1.02M | ringbuffer_mask, | 2429 | 1.02M | ringbuffer_break, | 2430 | 1.02M | dist_cache, | 2431 | 1.02M | position, | 2432 | 1.02M | max_length, | 2433 | 1.02M | max_distance, | 2434 | 1.02M | gap, | 2435 | 1.02M | params.dist.max_distance, | 2436 | 1.02M | &mut sr, | 2437 | | ) { | 2438 | 177k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 177k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 211k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 211k | let mut sr2 = HasherSearchResult { | 2445 | 211k | len: 0, | 2446 | 211k | len_x_code: 0, | 2447 | 211k | distance: 0, | 2448 | 211k | score: 0, | 2449 | 211k | }; | 2450 | 211k | sr2.len = if params.quality < 5 { | 2451 | 211k | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 0 | 0usize | 2454 | | }; | 2455 | 211k | sr2.len_x_code = 0usize; | 2456 | 211k | sr2.distance = 0usize; | 2457 | 211k | sr2.score = kMinScore; | 2458 | 211k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 211k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 211k | dictionary, | 2461 | 211k | dictionary_hash, | 2462 | 211k | ringbuffer, | 2463 | 211k | ringbuffer_mask, | 2464 | 211k | ringbuffer_break, | 2465 | 211k | dist_cache, | 2466 | 211k | position.wrapping_add(1), | 2467 | 211k | max_length, | 2468 | 211k | max_distance, | 2469 | 211k | gap, | 2470 | 211k | params.dist.max_distance, | 2471 | 211k | &mut sr2, | 2472 | | ); | 2473 | 211k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 34.7k | position = position.wrapping_add(1); | 2475 | 34.7k | insert_length = insert_length.wrapping_add(1); | 2476 | 34.7k | sr = sr2; | 2477 | 34.7k | if { | 2478 | 34.7k | delayed_backward_references_in_row += 1; | 2479 | 34.7k | delayed_backward_references_in_row | 2480 | 34.7k | } < 4i32 | 2481 | 34.7k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 34.7k | break 'continue7; | 2484 | 19 | } | 2485 | 176k | } | 2486 | 177k | break 'break6; | 2487 | | } | 2488 | 34.7k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 177k | apply_random_heuristics = position | 2491 | 177k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 177k | .wrapping_add(random_heuristics_window_size); | 2493 | 177k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 177k | let distance_code: usize = | 2496 | 177k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 177k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 128k | dist_cache[3] = dist_cache[2]; | 2499 | 128k | dist_cache[2] = dist_cache[1]; | 2500 | 128k | dist_cache[1] = dist_cache[0]; | 2501 | 128k | dist_cache[0] = sr.distance as i32; | 2502 | 128k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 128k | } | 2504 | 177k | new_commands_count += 1; | 2505 | | | 2506 | 177k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 177k | commands = new_commands; | 2508 | 177k | old[0].init( | 2509 | 177k | ¶ms.dist, | 2510 | 177k | insert_length, | 2511 | 177k | sr.len, | 2512 | 177k | sr.len ^ sr.len_x_code, | 2513 | 177k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 177k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 177k | insert_length = 0usize; | 2518 | 177k | hasher.StoreRange( | 2519 | 177k | ringbuffer, | 2520 | 177k | ringbuffer_mask, | 2521 | 177k | position.wrapping_add(2), | 2522 | 177k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 177k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 843k | insert_length = insert_length.wrapping_add(1); | 2527 | 843k | position = position.wrapping_add(1); | 2528 | | | 2529 | 843k | if position > apply_random_heuristics { | 2530 | 175k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 175k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 183 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 183 | position = pos_end; | 2534 | 174k | } else if position | 2535 | 174k | > apply_random_heuristics | 2536 | 174k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 147k | { | 2538 | 147k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 147k | insert_length = insert_length.wrapping_add(16); | 2540 | 147k | position = position.wrapping_add(16); | 2541 | 147k | } else { | 2542 | 27.4k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 27.4k | insert_length = insert_length.wrapping_add(8); | 2544 | 27.4k | position = position.wrapping_add(8); | 2545 | 27.4k | } | 2546 | 668k | } | 2547 | | } | 2548 | | } | 2549 | 1.29k | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 1.29k | *last_insert_len = insert_length; | 2551 | 1.29k | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 1.29k | } |
brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H4Sub<alloc_stdlib::std_alloc::StandardAlloc>>> Line | Count | Source | 2376 | 720 | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 720 | dictionary: Option<&BrotliDictionary>, | 2378 | 720 | dictionary_hash: &[u16], | 2379 | 720 | num_bytes: usize, | 2380 | 720 | mut position: usize, | 2381 | 720 | ringbuffer: &[u8], | 2382 | 720 | ringbuffer_mask: usize, | 2383 | 720 | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 720 | params: &BrotliEncoderParams, | 2385 | 720 | hasher: &mut AH, | 2386 | 720 | dist_cache: &mut [i32], | 2387 | 720 | last_insert_len: &mut usize, | 2388 | 720 | mut commands: &mut [Command], | 2389 | 720 | num_commands: &mut usize, | 2390 | 720 | num_literals: &mut usize, | 2391 | 720 | ) { | 2392 | 720 | let gap = 0usize; | 2393 | 720 | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 720 | let mut new_commands_count: usize = 0; | 2395 | 720 | let mut insert_length: usize = *last_insert_len; | 2396 | 720 | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 720 | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 703 | position | 2399 | 703 | .wrapping_add(num_bytes) | 2400 | 703 | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 703 | .wrapping_add(1) | 2402 | | } else { | 2403 | 17 | position | 2404 | | }; | 2405 | 720 | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 720 | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 720 | let kMinScore: u64 = (30u64 * 8) | 2408 | 720 | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 720 | .wrapping_add(100); | 2410 | 720 | hasher.PrepareDistanceCache(dist_cache); | 2411 | 1.27M | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 1.27M | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 1.27M | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 1.27M | let mut sr = HasherSearchResult { | 2415 | 1.27M | len: 0, | 2416 | 1.27M | len_x_code: 0, | 2417 | 1.27M | distance: 0, | 2418 | 1.27M | score: 0, | 2419 | 1.27M | }; | 2420 | 1.27M | sr.len = 0usize; | 2421 | 1.27M | sr.len_x_code = 0usize; | 2422 | 1.27M | sr.distance = 0usize; | 2423 | 1.27M | sr.score = kMinScore; | 2424 | 1.27M | if hasher.FindLongestMatch( | 2425 | 1.27M | dictionary, | 2426 | 1.27M | dictionary_hash, | 2427 | 1.27M | ringbuffer, | 2428 | 1.27M | ringbuffer_mask, | 2429 | 1.27M | ringbuffer_break, | 2430 | 1.27M | dist_cache, | 2431 | 1.27M | position, | 2432 | 1.27M | max_length, | 2433 | 1.27M | max_distance, | 2434 | 1.27M | gap, | 2435 | 1.27M | params.dist.max_distance, | 2436 | 1.27M | &mut sr, | 2437 | | ) { | 2438 | 201k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 201k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 228k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 228k | let mut sr2 = HasherSearchResult { | 2445 | 228k | len: 0, | 2446 | 228k | len_x_code: 0, | 2447 | 228k | distance: 0, | 2448 | 228k | score: 0, | 2449 | 228k | }; | 2450 | 228k | sr2.len = if params.quality < 5 { | 2451 | 228k | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 0 | 0usize | 2454 | | }; | 2455 | 228k | sr2.len_x_code = 0usize; | 2456 | 228k | sr2.distance = 0usize; | 2457 | 228k | sr2.score = kMinScore; | 2458 | 228k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 228k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 228k | dictionary, | 2461 | 228k | dictionary_hash, | 2462 | 228k | ringbuffer, | 2463 | 228k | ringbuffer_mask, | 2464 | 228k | ringbuffer_break, | 2465 | 228k | dist_cache, | 2466 | 228k | position.wrapping_add(1), | 2467 | 228k | max_length, | 2468 | 228k | max_distance, | 2469 | 228k | gap, | 2470 | 228k | params.dist.max_distance, | 2471 | 228k | &mut sr2, | 2472 | | ); | 2473 | 228k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 27.5k | position = position.wrapping_add(1); | 2475 | 27.5k | insert_length = insert_length.wrapping_add(1); | 2476 | 27.5k | sr = sr2; | 2477 | 27.5k | if { | 2478 | 27.5k | delayed_backward_references_in_row += 1; | 2479 | 27.5k | delayed_backward_references_in_row | 2480 | 27.5k | } < 4i32 | 2481 | 27.5k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 27.5k | break 'continue7; | 2484 | 28 | } | 2485 | 201k | } | 2486 | 201k | break 'break6; | 2487 | | } | 2488 | 27.5k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 201k | apply_random_heuristics = position | 2491 | 201k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 201k | .wrapping_add(random_heuristics_window_size); | 2493 | 201k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 201k | let distance_code: usize = | 2496 | 201k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 201k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 124k | dist_cache[3] = dist_cache[2]; | 2499 | 124k | dist_cache[2] = dist_cache[1]; | 2500 | 124k | dist_cache[1] = dist_cache[0]; | 2501 | 124k | dist_cache[0] = sr.distance as i32; | 2502 | 124k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 124k | } | 2504 | 201k | new_commands_count += 1; | 2505 | | | 2506 | 201k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 201k | commands = new_commands; | 2508 | 201k | old[0].init( | 2509 | 201k | ¶ms.dist, | 2510 | 201k | insert_length, | 2511 | 201k | sr.len, | 2512 | 201k | sr.len ^ sr.len_x_code, | 2513 | 201k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 201k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 201k | insert_length = 0usize; | 2518 | 201k | hasher.StoreRange( | 2519 | 201k | ringbuffer, | 2520 | 201k | ringbuffer_mask, | 2521 | 201k | position.wrapping_add(2), | 2522 | 201k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 201k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 1.07M | insert_length = insert_length.wrapping_add(1); | 2527 | 1.07M | position = position.wrapping_add(1); | 2528 | | | 2529 | 1.07M | if position > apply_random_heuristics { | 2530 | 186k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 186k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 74 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 74 | position = pos_end; | 2534 | 186k | } else if position | 2535 | 186k | > apply_random_heuristics | 2536 | 186k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 139k | { | 2538 | 139k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 139k | insert_length = insert_length.wrapping_add(16); | 2540 | 139k | position = position.wrapping_add(16); | 2541 | 139k | } else { | 2542 | 47.3k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 47.3k | insert_length = insert_length.wrapping_add(8); | 2544 | 47.3k | position = position.wrapping_add(8); | 2545 | 47.3k | } | 2546 | 885k | } | 2547 | | } | 2548 | | } | 2549 | 720 | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 720 | *last_insert_len = insert_length; | 2551 | 720 | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 720 | } |
Unexecuted instantiation: brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::BasicHasher<brotli::enc::backward_references::H54Sub<alloc_stdlib::std_alloc::StandardAlloc>>> brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::H9<alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 2376 | 637 | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 637 | dictionary: Option<&BrotliDictionary>, | 2378 | 637 | dictionary_hash: &[u16], | 2379 | 637 | num_bytes: usize, | 2380 | 637 | mut position: usize, | 2381 | 637 | ringbuffer: &[u8], | 2382 | 637 | ringbuffer_mask: usize, | 2383 | 637 | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 637 | params: &BrotliEncoderParams, | 2385 | 637 | hasher: &mut AH, | 2386 | 637 | dist_cache: &mut [i32], | 2387 | 637 | last_insert_len: &mut usize, | 2388 | 637 | mut commands: &mut [Command], | 2389 | 637 | num_commands: &mut usize, | 2390 | 637 | num_literals: &mut usize, | 2391 | 637 | ) { | 2392 | 637 | let gap = 0usize; | 2393 | 637 | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 637 | let mut new_commands_count: usize = 0; | 2395 | 637 | let mut insert_length: usize = *last_insert_len; | 2396 | 637 | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 637 | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 632 | position | 2399 | 632 | .wrapping_add(num_bytes) | 2400 | 632 | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 632 | .wrapping_add(1) | 2402 | | } else { | 2403 | 5 | position | 2404 | | }; | 2405 | 637 | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 637 | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 637 | let kMinScore: u64 = (30u64 * 8) | 2408 | 637 | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 637 | .wrapping_add(100); | 2410 | 637 | hasher.PrepareDistanceCache(dist_cache); | 2411 | 1.34M | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 1.34M | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 1.34M | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 1.34M | let mut sr = HasherSearchResult { | 2415 | 1.34M | len: 0, | 2416 | 1.34M | len_x_code: 0, | 2417 | 1.34M | distance: 0, | 2418 | 1.34M | score: 0, | 2419 | 1.34M | }; | 2420 | 1.34M | sr.len = 0usize; | 2421 | 1.34M | sr.len_x_code = 0usize; | 2422 | 1.34M | sr.distance = 0usize; | 2423 | 1.34M | sr.score = kMinScore; | 2424 | 1.34M | if hasher.FindLongestMatch( | 2425 | 1.34M | dictionary, | 2426 | 1.34M | dictionary_hash, | 2427 | 1.34M | ringbuffer, | 2428 | 1.34M | ringbuffer_mask, | 2429 | 1.34M | ringbuffer_break, | 2430 | 1.34M | dist_cache, | 2431 | 1.34M | position, | 2432 | 1.34M | max_length, | 2433 | 1.34M | max_distance, | 2434 | 1.34M | gap, | 2435 | 1.34M | params.dist.max_distance, | 2436 | 1.34M | &mut sr, | 2437 | | ) { | 2438 | 311k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 311k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 348k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 348k | let mut sr2 = HasherSearchResult { | 2445 | 348k | len: 0, | 2446 | 348k | len_x_code: 0, | 2447 | 348k | distance: 0, | 2448 | 348k | score: 0, | 2449 | 348k | }; | 2450 | 348k | sr2.len = if params.quality < 5 { | 2451 | 0 | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 348k | 0usize | 2454 | | }; | 2455 | 348k | sr2.len_x_code = 0usize; | 2456 | 348k | sr2.distance = 0usize; | 2457 | 348k | sr2.score = kMinScore; | 2458 | 348k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 348k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 348k | dictionary, | 2461 | 348k | dictionary_hash, | 2462 | 348k | ringbuffer, | 2463 | 348k | ringbuffer_mask, | 2464 | 348k | ringbuffer_break, | 2465 | 348k | dist_cache, | 2466 | 348k | position.wrapping_add(1), | 2467 | 348k | max_length, | 2468 | 348k | max_distance, | 2469 | 348k | gap, | 2470 | 348k | params.dist.max_distance, | 2471 | 348k | &mut sr2, | 2472 | | ); | 2473 | 348k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 36.5k | position = position.wrapping_add(1); | 2475 | 36.5k | insert_length = insert_length.wrapping_add(1); | 2476 | 36.5k | sr = sr2; | 2477 | 36.5k | if { | 2478 | 36.5k | delayed_backward_references_in_row += 1; | 2479 | 36.5k | delayed_backward_references_in_row | 2480 | 36.5k | } < 4i32 | 2481 | 36.5k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 36.5k | break 'continue7; | 2484 | 6 | } | 2485 | 311k | } | 2486 | 311k | break 'break6; | 2487 | | } | 2488 | 36.5k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 311k | apply_random_heuristics = position | 2491 | 311k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 311k | .wrapping_add(random_heuristics_window_size); | 2493 | 311k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 311k | let distance_code: usize = | 2496 | 311k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 311k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 202k | dist_cache[3] = dist_cache[2]; | 2499 | 202k | dist_cache[2] = dist_cache[1]; | 2500 | 202k | dist_cache[1] = dist_cache[0]; | 2501 | 202k | dist_cache[0] = sr.distance as i32; | 2502 | 202k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 202k | } | 2504 | 311k | new_commands_count += 1; | 2505 | | | 2506 | 311k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 311k | commands = new_commands; | 2508 | 311k | old[0].init( | 2509 | 311k | ¶ms.dist, | 2510 | 311k | insert_length, | 2511 | 311k | sr.len, | 2512 | 311k | sr.len ^ sr.len_x_code, | 2513 | 311k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 311k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 311k | insert_length = 0usize; | 2518 | 311k | hasher.StoreRange( | 2519 | 311k | ringbuffer, | 2520 | 311k | ringbuffer_mask, | 2521 | 311k | position.wrapping_add(2), | 2522 | 311k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 311k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 1.03M | insert_length = insert_length.wrapping_add(1); | 2527 | 1.03M | position = position.wrapping_add(1); | 2528 | | | 2529 | 1.03M | if position > apply_random_heuristics { | 2530 | 57.8k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 57.8k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 29 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 29 | position = pos_end; | 2534 | 57.8k | } else if position | 2535 | 57.8k | > apply_random_heuristics | 2536 | 57.8k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 21.1k | { | 2538 | 21.1k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 21.1k | insert_length = insert_length.wrapping_add(16); | 2540 | 21.1k | position = position.wrapping_add(16); | 2541 | 36.6k | } else { | 2542 | 36.6k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 36.6k | insert_length = insert_length.wrapping_add(8); | 2544 | 36.6k | position = position.wrapping_add(8); | 2545 | 36.6k | } | 2546 | 978k | } | 2547 | | } | 2548 | | } | 2549 | 637 | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 637 | *last_insert_len = insert_length; | 2551 | 637 | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 637 | } |
brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H5Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 2376 | 740 | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 740 | dictionary: Option<&BrotliDictionary>, | 2378 | 740 | dictionary_hash: &[u16], | 2379 | 740 | num_bytes: usize, | 2380 | 740 | mut position: usize, | 2381 | 740 | ringbuffer: &[u8], | 2382 | 740 | ringbuffer_mask: usize, | 2383 | 740 | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 740 | params: &BrotliEncoderParams, | 2385 | 740 | hasher: &mut AH, | 2386 | 740 | dist_cache: &mut [i32], | 2387 | 740 | last_insert_len: &mut usize, | 2388 | 740 | mut commands: &mut [Command], | 2389 | 740 | num_commands: &mut usize, | 2390 | 740 | num_literals: &mut usize, | 2391 | 740 | ) { | 2392 | 740 | let gap = 0usize; | 2393 | 740 | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 740 | let mut new_commands_count: usize = 0; | 2395 | 740 | let mut insert_length: usize = *last_insert_len; | 2396 | 740 | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 740 | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 716 | position | 2399 | 716 | .wrapping_add(num_bytes) | 2400 | 716 | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 716 | .wrapping_add(1) | 2402 | | } else { | 2403 | 24 | position | 2404 | | }; | 2405 | 740 | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 740 | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 740 | let kMinScore: u64 = (30u64 * 8) | 2408 | 740 | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 740 | .wrapping_add(100); | 2410 | 740 | hasher.PrepareDistanceCache(dist_cache); | 2411 | 423k | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 422k | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 422k | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 422k | let mut sr = HasherSearchResult { | 2415 | 422k | len: 0, | 2416 | 422k | len_x_code: 0, | 2417 | 422k | distance: 0, | 2418 | 422k | score: 0, | 2419 | 422k | }; | 2420 | 422k | sr.len = 0usize; | 2421 | 422k | sr.len_x_code = 0usize; | 2422 | 422k | sr.distance = 0usize; | 2423 | 422k | sr.score = kMinScore; | 2424 | 422k | if hasher.FindLongestMatch( | 2425 | 422k | dictionary, | 2426 | 422k | dictionary_hash, | 2427 | 422k | ringbuffer, | 2428 | 422k | ringbuffer_mask, | 2429 | 422k | ringbuffer_break, | 2430 | 422k | dist_cache, | 2431 | 422k | position, | 2432 | 422k | max_length, | 2433 | 422k | max_distance, | 2434 | 422k | gap, | 2435 | 422k | params.dist.max_distance, | 2436 | 422k | &mut sr, | 2437 | | ) { | 2438 | 108k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 108k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 127k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 127k | let mut sr2 = HasherSearchResult { | 2445 | 127k | len: 0, | 2446 | 127k | len_x_code: 0, | 2447 | 127k | distance: 0, | 2448 | 127k | score: 0, | 2449 | 127k | }; | 2450 | 127k | sr2.len = if params.quality < 5 { | 2451 | 0 | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 127k | 0usize | 2454 | | }; | 2455 | 127k | sr2.len_x_code = 0usize; | 2456 | 127k | sr2.distance = 0usize; | 2457 | 127k | sr2.score = kMinScore; | 2458 | 127k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 127k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 127k | dictionary, | 2461 | 127k | dictionary_hash, | 2462 | 127k | ringbuffer, | 2463 | 127k | ringbuffer_mask, | 2464 | 127k | ringbuffer_break, | 2465 | 127k | dist_cache, | 2466 | 127k | position.wrapping_add(1), | 2467 | 127k | max_length, | 2468 | 127k | max_distance, | 2469 | 127k | gap, | 2470 | 127k | params.dist.max_distance, | 2471 | 127k | &mut sr2, | 2472 | | ); | 2473 | 127k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 19.2k | position = position.wrapping_add(1); | 2475 | 19.2k | insert_length = insert_length.wrapping_add(1); | 2476 | 19.2k | sr = sr2; | 2477 | 19.2k | if { | 2478 | 19.2k | delayed_backward_references_in_row += 1; | 2479 | 19.2k | delayed_backward_references_in_row | 2480 | 19.2k | } < 4i32 | 2481 | 19.2k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 19.2k | break 'continue7; | 2484 | 4 | } | 2485 | 108k | } | 2486 | 108k | break 'break6; | 2487 | | } | 2488 | 19.2k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 108k | apply_random_heuristics = position | 2491 | 108k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 108k | .wrapping_add(random_heuristics_window_size); | 2493 | 108k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 108k | let distance_code: usize = | 2496 | 108k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 108k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 79.5k | dist_cache[3] = dist_cache[2]; | 2499 | 79.5k | dist_cache[2] = dist_cache[1]; | 2500 | 79.5k | dist_cache[1] = dist_cache[0]; | 2501 | 79.5k | dist_cache[0] = sr.distance as i32; | 2502 | 79.5k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 79.5k | } | 2504 | 108k | new_commands_count += 1; | 2505 | | | 2506 | 108k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 108k | commands = new_commands; | 2508 | 108k | old[0].init( | 2509 | 108k | ¶ms.dist, | 2510 | 108k | insert_length, | 2511 | 108k | sr.len, | 2512 | 108k | sr.len ^ sr.len_x_code, | 2513 | 108k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 108k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 108k | insert_length = 0usize; | 2518 | 108k | hasher.StoreRange( | 2519 | 108k | ringbuffer, | 2520 | 108k | ringbuffer_mask, | 2521 | 108k | position.wrapping_add(2), | 2522 | 108k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 108k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 313k | insert_length = insert_length.wrapping_add(1); | 2527 | 313k | position = position.wrapping_add(1); | 2528 | | | 2529 | 313k | if position > apply_random_heuristics { | 2530 | 35.6k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 35.6k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 28 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 28 | position = pos_end; | 2534 | 35.5k | } else if position | 2535 | 35.5k | > apply_random_heuristics | 2536 | 35.5k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 28.1k | { | 2538 | 28.1k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 28.1k | insert_length = insert_length.wrapping_add(16); | 2540 | 28.1k | position = position.wrapping_add(16); | 2541 | 28.1k | } else { | 2542 | 7.47k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 7.47k | insert_length = insert_length.wrapping_add(8); | 2544 | 7.47k | position = position.wrapping_add(8); | 2545 | 7.47k | } | 2546 | 278k | } | 2547 | | } | 2548 | | } | 2549 | 740 | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 740 | *last_insert_len = insert_length; | 2551 | 740 | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 740 | } |
brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::H6Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 2376 | 1.14k | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 1.14k | dictionary: Option<&BrotliDictionary>, | 2378 | 1.14k | dictionary_hash: &[u16], | 2379 | 1.14k | num_bytes: usize, | 2380 | 1.14k | mut position: usize, | 2381 | 1.14k | ringbuffer: &[u8], | 2382 | 1.14k | ringbuffer_mask: usize, | 2383 | 1.14k | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 1.14k | params: &BrotliEncoderParams, | 2385 | 1.14k | hasher: &mut AH, | 2386 | 1.14k | dist_cache: &mut [i32], | 2387 | 1.14k | last_insert_len: &mut usize, | 2388 | 1.14k | mut commands: &mut [Command], | 2389 | 1.14k | num_commands: &mut usize, | 2390 | 1.14k | num_literals: &mut usize, | 2391 | 1.14k | ) { | 2392 | 1.14k | let gap = 0usize; | 2393 | 1.14k | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 1.14k | let mut new_commands_count: usize = 0; | 2395 | 1.14k | let mut insert_length: usize = *last_insert_len; | 2396 | 1.14k | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 1.14k | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 1.12k | position | 2399 | 1.12k | .wrapping_add(num_bytes) | 2400 | 1.12k | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 1.12k | .wrapping_add(1) | 2402 | | } else { | 2403 | 16 | position | 2404 | | }; | 2405 | 1.14k | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 1.14k | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 1.14k | let kMinScore: u64 = (30u64 * 8) | 2408 | 1.14k | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 1.14k | .wrapping_add(100); | 2410 | 1.14k | hasher.PrepareDistanceCache(dist_cache); | 2411 | 3.09M | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 3.09M | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 3.09M | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 3.09M | let mut sr = HasherSearchResult { | 2415 | 3.09M | len: 0, | 2416 | 3.09M | len_x_code: 0, | 2417 | 3.09M | distance: 0, | 2418 | 3.09M | score: 0, | 2419 | 3.09M | }; | 2420 | 3.09M | sr.len = 0usize; | 2421 | 3.09M | sr.len_x_code = 0usize; | 2422 | 3.09M | sr.distance = 0usize; | 2423 | 3.09M | sr.score = kMinScore; | 2424 | 3.09M | if hasher.FindLongestMatch( | 2425 | 3.09M | dictionary, | 2426 | 3.09M | dictionary_hash, | 2427 | 3.09M | ringbuffer, | 2428 | 3.09M | ringbuffer_mask, | 2429 | 3.09M | ringbuffer_break, | 2430 | 3.09M | dist_cache, | 2431 | 3.09M | position, | 2432 | 3.09M | max_length, | 2433 | 3.09M | max_distance, | 2434 | 3.09M | gap, | 2435 | 3.09M | params.dist.max_distance, | 2436 | 3.09M | &mut sr, | 2437 | | ) { | 2438 | 497k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 497k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 541k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 541k | let mut sr2 = HasherSearchResult { | 2445 | 541k | len: 0, | 2446 | 541k | len_x_code: 0, | 2447 | 541k | distance: 0, | 2448 | 541k | score: 0, | 2449 | 541k | }; | 2450 | 541k | sr2.len = if params.quality < 5 { | 2451 | 0 | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 541k | 0usize | 2454 | | }; | 2455 | 541k | sr2.len_x_code = 0usize; | 2456 | 541k | sr2.distance = 0usize; | 2457 | 541k | sr2.score = kMinScore; | 2458 | 541k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 541k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 541k | dictionary, | 2461 | 541k | dictionary_hash, | 2462 | 541k | ringbuffer, | 2463 | 541k | ringbuffer_mask, | 2464 | 541k | ringbuffer_break, | 2465 | 541k | dist_cache, | 2466 | 541k | position.wrapping_add(1), | 2467 | 541k | max_length, | 2468 | 541k | max_distance, | 2469 | 541k | gap, | 2470 | 541k | params.dist.max_distance, | 2471 | 541k | &mut sr2, | 2472 | | ); | 2473 | 541k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 44.4k | position = position.wrapping_add(1); | 2475 | 44.4k | insert_length = insert_length.wrapping_add(1); | 2476 | 44.4k | sr = sr2; | 2477 | 44.4k | if { | 2478 | 44.4k | delayed_backward_references_in_row += 1; | 2479 | 44.4k | delayed_backward_references_in_row | 2480 | 44.4k | } < 4i32 | 2481 | 44.4k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 44.4k | break 'continue7; | 2484 | 26 | } | 2485 | 497k | } | 2486 | 497k | break 'break6; | 2487 | | } | 2488 | 44.4k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 497k | apply_random_heuristics = position | 2491 | 497k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 497k | .wrapping_add(random_heuristics_window_size); | 2493 | 497k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 497k | let distance_code: usize = | 2496 | 497k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 497k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 344k | dist_cache[3] = dist_cache[2]; | 2499 | 344k | dist_cache[2] = dist_cache[1]; | 2500 | 344k | dist_cache[1] = dist_cache[0]; | 2501 | 344k | dist_cache[0] = sr.distance as i32; | 2502 | 344k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 344k | } | 2504 | 497k | new_commands_count += 1; | 2505 | | | 2506 | 497k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 497k | commands = new_commands; | 2508 | 497k | old[0].init( | 2509 | 497k | ¶ms.dist, | 2510 | 497k | insert_length, | 2511 | 497k | sr.len, | 2512 | 497k | sr.len ^ sr.len_x_code, | 2513 | 497k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 497k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 497k | insert_length = 0usize; | 2518 | 497k | hasher.StoreRange( | 2519 | 497k | ringbuffer, | 2520 | 497k | ringbuffer_mask, | 2521 | 497k | position.wrapping_add(2), | 2522 | 497k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 497k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 2.59M | insert_length = insert_length.wrapping_add(1); | 2527 | 2.59M | position = position.wrapping_add(1); | 2528 | | | 2529 | 2.59M | if position > apply_random_heuristics { | 2530 | 393k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 393k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 136 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 136 | position = pos_end; | 2534 | 393k | } else if position | 2535 | 393k | > apply_random_heuristics | 2536 | 393k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 269k | { | 2538 | 269k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 269k | insert_length = insert_length.wrapping_add(16); | 2540 | 269k | position = position.wrapping_add(16); | 2541 | 269k | } else { | 2542 | 123k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 123k | insert_length = insert_length.wrapping_add(8); | 2544 | 123k | position = position.wrapping_add(8); | 2545 | 123k | } | 2546 | 2.20M | } | 2547 | | } | 2548 | | } | 2549 | 1.14k | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 1.14k | *last_insert_len = insert_length; | 2551 | 1.14k | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 1.14k | } |
brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ5Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 2376 | 698 | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 698 | dictionary: Option<&BrotliDictionary>, | 2378 | 698 | dictionary_hash: &[u16], | 2379 | 698 | num_bytes: usize, | 2380 | 698 | mut position: usize, | 2381 | 698 | ringbuffer: &[u8], | 2382 | 698 | ringbuffer_mask: usize, | 2383 | 698 | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 698 | params: &BrotliEncoderParams, | 2385 | 698 | hasher: &mut AH, | 2386 | 698 | dist_cache: &mut [i32], | 2387 | 698 | last_insert_len: &mut usize, | 2388 | 698 | mut commands: &mut [Command], | 2389 | 698 | num_commands: &mut usize, | 2390 | 698 | num_literals: &mut usize, | 2391 | 698 | ) { | 2392 | 698 | let gap = 0usize; | 2393 | 698 | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 698 | let mut new_commands_count: usize = 0; | 2395 | 698 | let mut insert_length: usize = *last_insert_len; | 2396 | 698 | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 698 | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 681 | position | 2399 | 681 | .wrapping_add(num_bytes) | 2400 | 681 | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 681 | .wrapping_add(1) | 2402 | | } else { | 2403 | 17 | position | 2404 | | }; | 2405 | 698 | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 698 | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 698 | let kMinScore: u64 = (30u64 * 8) | 2408 | 698 | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 698 | .wrapping_add(100); | 2410 | 698 | hasher.PrepareDistanceCache(dist_cache); | 2411 | 285k | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 284k | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 284k | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 284k | let mut sr = HasherSearchResult { | 2415 | 284k | len: 0, | 2416 | 284k | len_x_code: 0, | 2417 | 284k | distance: 0, | 2418 | 284k | score: 0, | 2419 | 284k | }; | 2420 | 284k | sr.len = 0usize; | 2421 | 284k | sr.len_x_code = 0usize; | 2422 | 284k | sr.distance = 0usize; | 2423 | 284k | sr.score = kMinScore; | 2424 | 284k | if hasher.FindLongestMatch( | 2425 | 284k | dictionary, | 2426 | 284k | dictionary_hash, | 2427 | 284k | ringbuffer, | 2428 | 284k | ringbuffer_mask, | 2429 | 284k | ringbuffer_break, | 2430 | 284k | dist_cache, | 2431 | 284k | position, | 2432 | 284k | max_length, | 2433 | 284k | max_distance, | 2434 | 284k | gap, | 2435 | 284k | params.dist.max_distance, | 2436 | 284k | &mut sr, | 2437 | | ) { | 2438 | 93.3k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 93.3k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 108k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 108k | let mut sr2 = HasherSearchResult { | 2445 | 108k | len: 0, | 2446 | 108k | len_x_code: 0, | 2447 | 108k | distance: 0, | 2448 | 108k | score: 0, | 2449 | 108k | }; | 2450 | 108k | sr2.len = if params.quality < 5 { | 2451 | 0 | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 108k | 0usize | 2454 | | }; | 2455 | 108k | sr2.len_x_code = 0usize; | 2456 | 108k | sr2.distance = 0usize; | 2457 | 108k | sr2.score = kMinScore; | 2458 | 108k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 108k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 108k | dictionary, | 2461 | 108k | dictionary_hash, | 2462 | 108k | ringbuffer, | 2463 | 108k | ringbuffer_mask, | 2464 | 108k | ringbuffer_break, | 2465 | 108k | dist_cache, | 2466 | 108k | position.wrapping_add(1), | 2467 | 108k | max_length, | 2468 | 108k | max_distance, | 2469 | 108k | gap, | 2470 | 108k | params.dist.max_distance, | 2471 | 108k | &mut sr2, | 2472 | | ); | 2473 | 108k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 14.8k | position = position.wrapping_add(1); | 2475 | 14.8k | insert_length = insert_length.wrapping_add(1); | 2476 | 14.8k | sr = sr2; | 2477 | 14.8k | if { | 2478 | 14.8k | delayed_backward_references_in_row += 1; | 2479 | 14.8k | delayed_backward_references_in_row | 2480 | 14.8k | } < 4i32 | 2481 | 14.8k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 14.8k | break 'continue7; | 2484 | 5 | } | 2485 | 93.3k | } | 2486 | 93.3k | break 'break6; | 2487 | | } | 2488 | 14.8k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 93.3k | apply_random_heuristics = position | 2491 | 93.3k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 93.3k | .wrapping_add(random_heuristics_window_size); | 2493 | 93.3k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 93.3k | let distance_code: usize = | 2496 | 93.3k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 93.3k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 61.2k | dist_cache[3] = dist_cache[2]; | 2499 | 61.2k | dist_cache[2] = dist_cache[1]; | 2500 | 61.2k | dist_cache[1] = dist_cache[0]; | 2501 | 61.2k | dist_cache[0] = sr.distance as i32; | 2502 | 61.2k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 61.2k | } | 2504 | 93.3k | new_commands_count += 1; | 2505 | | | 2506 | 93.3k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 93.3k | commands = new_commands; | 2508 | 93.3k | old[0].init( | 2509 | 93.3k | ¶ms.dist, | 2510 | 93.3k | insert_length, | 2511 | 93.3k | sr.len, | 2512 | 93.3k | sr.len ^ sr.len_x_code, | 2513 | 93.3k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 93.3k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 93.3k | insert_length = 0usize; | 2518 | 93.3k | hasher.StoreRange( | 2519 | 93.3k | ringbuffer, | 2520 | 93.3k | ringbuffer_mask, | 2521 | 93.3k | position.wrapping_add(2), | 2522 | 93.3k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 93.3k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 191k | insert_length = insert_length.wrapping_add(1); | 2527 | 191k | position = position.wrapping_add(1); | 2528 | | | 2529 | 191k | if position > apply_random_heuristics { | 2530 | 25.4k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 25.4k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 31 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 31 | position = pos_end; | 2534 | 25.4k | } else if position | 2535 | 25.4k | > apply_random_heuristics | 2536 | 25.4k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 17.3k | { | 2538 | 17.3k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 17.3k | insert_length = insert_length.wrapping_add(16); | 2540 | 17.3k | position = position.wrapping_add(16); | 2541 | 17.3k | } else { | 2542 | 8.12k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 8.12k | insert_length = insert_length.wrapping_add(8); | 2544 | 8.12k | position = position.wrapping_add(8); | 2545 | 8.12k | } | 2546 | 165k | } | 2547 | | } | 2548 | | } | 2549 | 698 | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 698 | *last_insert_len = insert_length; | 2551 | 698 | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 698 | } |
brotli::enc::backward_references::CreateBackwardReferences::<brotli::enc::backward_references::AdvHasher<brotli::enc::backward_references::HQ7Sub, alloc_stdlib::std_alloc::StandardAlloc>> Line | Count | Source | 2376 | 588 | fn CreateBackwardReferences<AH: AnyHasher>( | 2377 | 588 | dictionary: Option<&BrotliDictionary>, | 2378 | 588 | dictionary_hash: &[u16], | 2379 | 588 | num_bytes: usize, | 2380 | 588 | mut position: usize, | 2381 | 588 | ringbuffer: &[u8], | 2382 | 588 | ringbuffer_mask: usize, | 2383 | 588 | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2384 | 588 | params: &BrotliEncoderParams, | 2385 | 588 | hasher: &mut AH, | 2386 | 588 | dist_cache: &mut [i32], | 2387 | 588 | last_insert_len: &mut usize, | 2388 | 588 | mut commands: &mut [Command], | 2389 | 588 | num_commands: &mut usize, | 2390 | 588 | num_literals: &mut usize, | 2391 | 588 | ) { | 2392 | 588 | let gap = 0usize; | 2393 | 588 | let max_backward_limit: usize = (1usize << params.lgwin).wrapping_sub(16); | 2394 | 588 | let mut new_commands_count: usize = 0; | 2395 | 588 | let mut insert_length: usize = *last_insert_len; | 2396 | 588 | let pos_end: usize = position.wrapping_add(num_bytes); | 2397 | 588 | let store_end: usize = if num_bytes >= hasher.StoreLookahead() { | 2398 | 572 | position | 2399 | 572 | .wrapping_add(num_bytes) | 2400 | 572 | .wrapping_sub(hasher.StoreLookahead()) | 2401 | 572 | .wrapping_add(1) | 2402 | | } else { | 2403 | 16 | position | 2404 | | }; | 2405 | 588 | let random_heuristics_window_size: usize = LiteralSpreeLengthForSparseSearch(params); | 2406 | 588 | let mut apply_random_heuristics: usize = position.wrapping_add(random_heuristics_window_size); | 2407 | 588 | let kMinScore: u64 = (30u64 * 8) | 2408 | 588 | .wrapping_mul(::core::mem::size_of::<u64>() as u64) | 2409 | 588 | .wrapping_add(100); | 2410 | 588 | hasher.PrepareDistanceCache(dist_cache); | 2411 | 187k | while position.wrapping_add(hasher.HashTypeLength()) < pos_end { | 2412 | 186k | let mut max_length: usize = pos_end.wrapping_sub(position); | 2413 | 186k | let mut max_distance: usize = min(position, max_backward_limit); | 2414 | 186k | let mut sr = HasherSearchResult { | 2415 | 186k | len: 0, | 2416 | 186k | len_x_code: 0, | 2417 | 186k | distance: 0, | 2418 | 186k | score: 0, | 2419 | 186k | }; | 2420 | 186k | sr.len = 0usize; | 2421 | 186k | sr.len_x_code = 0usize; | 2422 | 186k | sr.distance = 0usize; | 2423 | 186k | sr.score = kMinScore; | 2424 | 186k | if hasher.FindLongestMatch( | 2425 | 186k | dictionary, | 2426 | 186k | dictionary_hash, | 2427 | 186k | ringbuffer, | 2428 | 186k | ringbuffer_mask, | 2429 | 186k | ringbuffer_break, | 2430 | 186k | dist_cache, | 2431 | 186k | position, | 2432 | 186k | max_length, | 2433 | 186k | max_distance, | 2434 | 186k | gap, | 2435 | 186k | params.dist.max_distance, | 2436 | 186k | &mut sr, | 2437 | | ) { | 2438 | 46.7k | let mut delayed_backward_references_in_row: i32 = 0i32; | 2439 | 46.7k | max_length = max_length.wrapping_sub(1); | 2440 | | 'break6: loop { | 2441 | | 'continue7: loop { | 2442 | 56.3k | let cost_diff_lazy: u64 = 175; | 2443 | | | 2444 | 56.3k | let mut sr2 = HasherSearchResult { | 2445 | 56.3k | len: 0, | 2446 | 56.3k | len_x_code: 0, | 2447 | 56.3k | distance: 0, | 2448 | 56.3k | score: 0, | 2449 | 56.3k | }; | 2450 | 56.3k | sr2.len = if params.quality < 5 { | 2451 | 0 | min(sr.len.wrapping_sub(1), max_length) | 2452 | | } else { | 2453 | 56.3k | 0usize | 2454 | | }; | 2455 | 56.3k | sr2.len_x_code = 0usize; | 2456 | 56.3k | sr2.distance = 0usize; | 2457 | 56.3k | sr2.score = kMinScore; | 2458 | 56.3k | max_distance = min(position.wrapping_add(1), max_backward_limit); | 2459 | 56.3k | let is_match_found: bool = hasher.FindLongestMatch( | 2460 | 56.3k | dictionary, | 2461 | 56.3k | dictionary_hash, | 2462 | 56.3k | ringbuffer, | 2463 | 56.3k | ringbuffer_mask, | 2464 | 56.3k | ringbuffer_break, | 2465 | 56.3k | dist_cache, | 2466 | 56.3k | position.wrapping_add(1), | 2467 | 56.3k | max_length, | 2468 | 56.3k | max_distance, | 2469 | 56.3k | gap, | 2470 | 56.3k | params.dist.max_distance, | 2471 | 56.3k | &mut sr2, | 2472 | | ); | 2473 | 56.3k | if is_match_found && (sr2.score >= sr.score.wrapping_add(cost_diff_lazy)) { | 2474 | 9.54k | position = position.wrapping_add(1); | 2475 | 9.54k | insert_length = insert_length.wrapping_add(1); | 2476 | 9.54k | sr = sr2; | 2477 | 9.54k | if { | 2478 | 9.54k | delayed_backward_references_in_row += 1; | 2479 | 9.54k | delayed_backward_references_in_row | 2480 | 9.54k | } < 4i32 | 2481 | 9.54k | && (position.wrapping_add(hasher.HashTypeLength()) < pos_end) | 2482 | | { | 2483 | 9.54k | break 'continue7; | 2484 | 3 | } | 2485 | 46.7k | } | 2486 | 46.7k | break 'break6; | 2487 | | } | 2488 | 9.54k | max_length = max_length.wrapping_sub(1); | 2489 | | } | 2490 | 46.7k | apply_random_heuristics = position | 2491 | 46.7k | .wrapping_add((2usize).wrapping_mul(sr.len)) | 2492 | 46.7k | .wrapping_add(random_heuristics_window_size); | 2493 | 46.7k | max_distance = min(position, max_backward_limit); | 2494 | | { | 2495 | 46.7k | let distance_code: usize = | 2496 | 46.7k | ComputeDistanceCode(sr.distance, max_distance, dist_cache); | 2497 | 46.7k | if sr.distance <= max_distance && (distance_code > 0usize) { | 2498 | 32.9k | dist_cache[3] = dist_cache[2]; | 2499 | 32.9k | dist_cache[2] = dist_cache[1]; | 2500 | 32.9k | dist_cache[1] = dist_cache[0]; | 2501 | 32.9k | dist_cache[0] = sr.distance as i32; | 2502 | 32.9k | hasher.PrepareDistanceCache(dist_cache); | 2503 | 32.9k | } | 2504 | 46.7k | new_commands_count += 1; | 2505 | | | 2506 | 46.7k | let (old, new_commands) = core::mem::take(&mut commands).split_at_mut(1); | 2507 | 46.7k | commands = new_commands; | 2508 | 46.7k | old[0].init( | 2509 | 46.7k | ¶ms.dist, | 2510 | 46.7k | insert_length, | 2511 | 46.7k | sr.len, | 2512 | 46.7k | sr.len ^ sr.len_x_code, | 2513 | 46.7k | distance_code, | 2514 | | ); | 2515 | | } | 2516 | 46.7k | *num_literals = num_literals.wrapping_add(insert_length); | 2517 | 46.7k | insert_length = 0usize; | 2518 | 46.7k | hasher.StoreRange( | 2519 | 46.7k | ringbuffer, | 2520 | 46.7k | ringbuffer_mask, | 2521 | 46.7k | position.wrapping_add(2), | 2522 | 46.7k | min(position.wrapping_add(sr.len), store_end), | 2523 | | ); | 2524 | 46.7k | position = position.wrapping_add(sr.len); | 2525 | | } else { | 2526 | 139k | insert_length = insert_length.wrapping_add(1); | 2527 | 139k | position = position.wrapping_add(1); | 2528 | | | 2529 | 139k | if position > apply_random_heuristics { | 2530 | 20.9k | let kMargin: usize = max(hasher.StoreLookahead().wrapping_sub(1), 4); | 2531 | 20.9k | if position.wrapping_add(16) >= pos_end.wrapping_sub(kMargin) { | 2532 | 39 | insert_length = insert_length.wrapping_add(pos_end - position); | 2533 | 39 | position = pos_end; | 2534 | 20.9k | } else if position | 2535 | 20.9k | > apply_random_heuristics | 2536 | 20.9k | .wrapping_add((4usize).wrapping_mul(random_heuristics_window_size)) | 2537 | 14.8k | { | 2538 | 14.8k | hasher.Store4Vec4(ringbuffer, ringbuffer_mask, position); | 2539 | 14.8k | insert_length = insert_length.wrapping_add(16); | 2540 | 14.8k | position = position.wrapping_add(16); | 2541 | 14.8k | } else { | 2542 | 6.09k | hasher.StoreEvenVec4(ringbuffer, ringbuffer_mask, position); | 2543 | 6.09k | insert_length = insert_length.wrapping_add(8); | 2544 | 6.09k | position = position.wrapping_add(8); | 2545 | 6.09k | } | 2546 | 118k | } | 2547 | | } | 2548 | | } | 2549 | 588 | insert_length = insert_length.wrapping_add(pos_end.wrapping_sub(position)); | 2550 | 588 | *last_insert_len = insert_length; | 2551 | 588 | *num_commands = num_commands.wrapping_add(new_commands_count); | 2552 | 588 | } |
Unexecuted instantiation: brotli::enc::backward_references::CreateBackwardReferences::<_> |
2553 | 15.4k | pub fn BrotliCreateBackwardReferences< |
2554 | 15.4k | Alloc: alloc::Allocator<u16> |
2555 | 15.4k | + alloc::Allocator<u32> |
2556 | 15.4k | + alloc::Allocator<u64> |
2557 | 15.4k | + alloc::Allocator<floatX> |
2558 | 15.4k | + alloc::Allocator<ZopfliNode>, |
2559 | 15.4k | >( |
2560 | 15.4k | alloc: &mut Alloc, |
2561 | 15.4k | dictionary: &BrotliDictionary, |
2562 | 15.4k | num_bytes: usize, |
2563 | 15.4k | position: usize, |
2564 | 15.4k | ringbuffer: &[u8], |
2565 | 15.4k | ringbuffer_mask: usize, |
2566 | 15.4k | ringbuffer_break: Option<core::num::NonZeroUsize>, |
2567 | 15.4k | params: &BrotliEncoderParams, |
2568 | 15.4k | hasher_union: &mut UnionHasher<Alloc>, |
2569 | 15.4k | dist_cache: &mut [i32], |
2570 | 15.4k | last_insert_len: &mut usize, |
2571 | 15.4k | commands: &mut [Command], |
2572 | 15.4k | num_commands: &mut usize, |
2573 | 15.4k | num_literals: &mut usize, |
2574 | 15.4k | ) { |
2575 | 15.4k | match (hasher_union) { |
2576 | 0 | &mut UnionHasher::Uninit => panic!("working with uninitialized hash map"), |
2577 | 7.52k | &mut UnionHasher::H10(ref mut hasher) => { |
2578 | 7.52k | if params.quality >= 11 { |
2579 | 7.13k | super::backward_references_hq::BrotliCreateHqZopfliBackwardReferences( |
2580 | 7.13k | alloc, |
2581 | 7.13k | if params.use_dictionary { |
2582 | 7.13k | Some(dictionary) |
2583 | | } else { |
2584 | 0 | None |
2585 | | }, |
2586 | 7.13k | num_bytes, |
2587 | 7.13k | position, |
2588 | 7.13k | ringbuffer, |
2589 | 7.13k | ringbuffer_mask, |
2590 | 7.13k | ringbuffer_break, |
2591 | 7.13k | params, |
2592 | 7.13k | hasher, |
2593 | 7.13k | dist_cache, |
2594 | 7.13k | last_insert_len, |
2595 | 7.13k | commands, |
2596 | 7.13k | num_commands, |
2597 | 7.13k | num_literals, |
2598 | | ) |
2599 | | } else { |
2600 | 392 | super::backward_references_hq::BrotliCreateZopfliBackwardReferences( |
2601 | 392 | alloc, |
2602 | 392 | if params.use_dictionary { |
2603 | 392 | Some(dictionary) |
2604 | | } else { |
2605 | 0 | None |
2606 | | }, |
2607 | 392 | num_bytes, |
2608 | 392 | position, |
2609 | 392 | ringbuffer, |
2610 | 392 | ringbuffer_mask, |
2611 | 392 | ringbuffer_break, |
2612 | 392 | params, |
2613 | 392 | hasher, |
2614 | 392 | dist_cache, |
2615 | 392 | last_insert_len, |
2616 | 392 | commands, |
2617 | 392 | num_commands, |
2618 | 392 | num_literals, |
2619 | | ) |
2620 | | } |
2621 | | } |
2622 | 2.08k | &mut UnionHasher::H2(ref mut hasher) => CreateBackwardReferences( |
2623 | 2.08k | if params.use_dictionary { |
2624 | 2.08k | Some(dictionary) |
2625 | | } else { |
2626 | 0 | None |
2627 | | }, |
2628 | 2.08k | &kStaticDictionaryHash[..], |
2629 | 2.08k | num_bytes, |
2630 | 2.08k | position, |
2631 | 2.08k | ringbuffer, |
2632 | 2.08k | ringbuffer_mask, |
2633 | 2.08k | ringbuffer_break, |
2634 | 2.08k | params, |
2635 | 2.08k | hasher, |
2636 | 2.08k | dist_cache, |
2637 | 2.08k | last_insert_len, |
2638 | 2.08k | commands, |
2639 | 2.08k | num_commands, |
2640 | 2.08k | num_literals, |
2641 | | ), |
2642 | 1.29k | &mut UnionHasher::H3(ref mut hasher) => CreateBackwardReferences( |
2643 | 1.29k | if params.use_dictionary { |
2644 | 1.29k | Some(dictionary) |
2645 | | } else { |
2646 | 0 | None |
2647 | | }, |
2648 | 1.29k | &kStaticDictionaryHash[..], |
2649 | 1.29k | num_bytes, |
2650 | 1.29k | position, |
2651 | 1.29k | ringbuffer, |
2652 | 1.29k | ringbuffer_mask, |
2653 | 1.29k | ringbuffer_break, |
2654 | 1.29k | params, |
2655 | 1.29k | hasher, |
2656 | 1.29k | dist_cache, |
2657 | 1.29k | last_insert_len, |
2658 | 1.29k | commands, |
2659 | 1.29k | num_commands, |
2660 | 1.29k | num_literals, |
2661 | | ), |
2662 | 720 | &mut UnionHasher::H4(ref mut hasher) => CreateBackwardReferences( |
2663 | 720 | if params.use_dictionary { |
2664 | 720 | Some(dictionary) |
2665 | | } else { |
2666 | 0 | None |
2667 | | }, |
2668 | 720 | &kStaticDictionaryHash[..], |
2669 | 720 | num_bytes, |
2670 | 720 | position, |
2671 | 720 | ringbuffer, |
2672 | 720 | ringbuffer_mask, |
2673 | 720 | ringbuffer_break, |
2674 | 720 | params, |
2675 | 720 | hasher, |
2676 | 720 | dist_cache, |
2677 | 720 | last_insert_len, |
2678 | 720 | commands, |
2679 | 720 | num_commands, |
2680 | 720 | num_literals, |
2681 | | ), |
2682 | 740 | &mut UnionHasher::H5(ref mut hasher) => CreateBackwardReferences( |
2683 | 740 | if params.use_dictionary { |
2684 | 740 | Some(dictionary) |
2685 | | } else { |
2686 | 0 | None |
2687 | | }, |
2688 | 740 | &kStaticDictionaryHash[..], |
2689 | 740 | num_bytes, |
2690 | 740 | position, |
2691 | 740 | ringbuffer, |
2692 | 740 | ringbuffer_mask, |
2693 | 740 | ringbuffer_break, |
2694 | 740 | params, |
2695 | 740 | hasher, |
2696 | 740 | dist_cache, |
2697 | 740 | last_insert_len, |
2698 | 740 | commands, |
2699 | 740 | num_commands, |
2700 | 740 | num_literals, |
2701 | | ), |
2702 | 588 | &mut UnionHasher::H5q7(ref mut hasher) => CreateBackwardReferences( |
2703 | 588 | if params.use_dictionary { |
2704 | 588 | Some(dictionary) |
2705 | | } else { |
2706 | 0 | None |
2707 | | }, |
2708 | 588 | &kStaticDictionaryHash[..], |
2709 | 588 | num_bytes, |
2710 | 588 | position, |
2711 | 588 | ringbuffer, |
2712 | 588 | ringbuffer_mask, |
2713 | 588 | ringbuffer_break, |
2714 | 588 | params, |
2715 | 588 | hasher, |
2716 | 588 | dist_cache, |
2717 | 588 | last_insert_len, |
2718 | 588 | commands, |
2719 | 588 | num_commands, |
2720 | 588 | num_literals, |
2721 | | ), |
2722 | 698 | &mut UnionHasher::H5q5(ref mut hasher) => CreateBackwardReferences( |
2723 | 698 | if params.use_dictionary { |
2724 | 698 | Some(dictionary) |
2725 | | } else { |
2726 | 0 | None |
2727 | | }, |
2728 | 698 | &kStaticDictionaryHash[..], |
2729 | 698 | num_bytes, |
2730 | 698 | position, |
2731 | 698 | ringbuffer, |
2732 | 698 | ringbuffer_mask, |
2733 | 698 | ringbuffer_break, |
2734 | 698 | params, |
2735 | 698 | hasher, |
2736 | 698 | dist_cache, |
2737 | 698 | last_insert_len, |
2738 | 698 | commands, |
2739 | 698 | num_commands, |
2740 | 698 | num_literals, |
2741 | | ), |
2742 | 1.14k | &mut UnionHasher::H6(ref mut hasher) => CreateBackwardReferences( |
2743 | 1.14k | if params.use_dictionary { |
2744 | 1.14k | Some(dictionary) |
2745 | | } else { |
2746 | 0 | None |
2747 | | }, |
2748 | 1.14k | &kStaticDictionaryHash[..], |
2749 | 1.14k | num_bytes, |
2750 | 1.14k | position, |
2751 | 1.14k | ringbuffer, |
2752 | 1.14k | ringbuffer_mask, |
2753 | 1.14k | ringbuffer_break, |
2754 | 1.14k | params, |
2755 | 1.14k | hasher, |
2756 | 1.14k | dist_cache, |
2757 | 1.14k | last_insert_len, |
2758 | 1.14k | commands, |
2759 | 1.14k | num_commands, |
2760 | 1.14k | num_literals, |
2761 | | ), |
2762 | 637 | &mut UnionHasher::H9(ref mut hasher) => CreateBackwardReferences( |
2763 | 637 | if params.use_dictionary { |
2764 | 637 | Some(dictionary) |
2765 | | } else { |
2766 | 0 | None |
2767 | | }, |
2768 | 637 | &kStaticDictionaryHash[..], |
2769 | 637 | num_bytes, |
2770 | 637 | position, |
2771 | 637 | ringbuffer, |
2772 | 637 | ringbuffer_mask, |
2773 | 637 | ringbuffer_break, |
2774 | 637 | params, |
2775 | 637 | hasher, |
2776 | 637 | dist_cache, |
2777 | 637 | last_insert_len, |
2778 | 637 | commands, |
2779 | 637 | num_commands, |
2780 | 637 | num_literals, |
2781 | | ), |
2782 | 0 | &mut UnionHasher::H54(ref mut hasher) => CreateBackwardReferences( |
2783 | 0 | if params.use_dictionary { |
2784 | 0 | Some(dictionary) |
2785 | | } else { |
2786 | 0 | None |
2787 | | }, |
2788 | 0 | &kStaticDictionaryHash[..], |
2789 | 0 | num_bytes, |
2790 | 0 | position, |
2791 | 0 | ringbuffer, |
2792 | 0 | ringbuffer_mask, |
2793 | 0 | ringbuffer_break, |
2794 | 0 | params, |
2795 | 0 | hasher, |
2796 | 0 | dist_cache, |
2797 | 0 | last_insert_len, |
2798 | 0 | commands, |
2799 | 0 | num_commands, |
2800 | 0 | num_literals, |
2801 | | ), |
2802 | | } |
2803 | 15.4k | } brotli::enc::backward_references::BrotliCreateBackwardReferences::<alloc_stdlib::std_alloc::StandardAlloc> Line | Count | Source | 2553 | 15.4k | pub fn BrotliCreateBackwardReferences< | 2554 | 15.4k | Alloc: alloc::Allocator<u16> | 2555 | 15.4k | + alloc::Allocator<u32> | 2556 | 15.4k | + alloc::Allocator<u64> | 2557 | 15.4k | + alloc::Allocator<floatX> | 2558 | 15.4k | + alloc::Allocator<ZopfliNode>, | 2559 | 15.4k | >( | 2560 | 15.4k | alloc: &mut Alloc, | 2561 | 15.4k | dictionary: &BrotliDictionary, | 2562 | 15.4k | num_bytes: usize, | 2563 | 15.4k | position: usize, | 2564 | 15.4k | ringbuffer: &[u8], | 2565 | 15.4k | ringbuffer_mask: usize, | 2566 | 15.4k | ringbuffer_break: Option<core::num::NonZeroUsize>, | 2567 | 15.4k | params: &BrotliEncoderParams, | 2568 | 15.4k | hasher_union: &mut UnionHasher<Alloc>, | 2569 | 15.4k | dist_cache: &mut [i32], | 2570 | 15.4k | last_insert_len: &mut usize, | 2571 | 15.4k | commands: &mut [Command], | 2572 | 15.4k | num_commands: &mut usize, | 2573 | 15.4k | num_literals: &mut usize, | 2574 | 15.4k | ) { | 2575 | 15.4k | match (hasher_union) { | 2576 | 0 | &mut UnionHasher::Uninit => panic!("working with uninitialized hash map"), | 2577 | 7.52k | &mut UnionHasher::H10(ref mut hasher) => { | 2578 | 7.52k | if params.quality >= 11 { | 2579 | 7.13k | super::backward_references_hq::BrotliCreateHqZopfliBackwardReferences( | 2580 | 7.13k | alloc, | 2581 | 7.13k | if params.use_dictionary { | 2582 | 7.13k | Some(dictionary) | 2583 | | } else { | 2584 | 0 | None | 2585 | | }, | 2586 | 7.13k | num_bytes, | 2587 | 7.13k | position, | 2588 | 7.13k | ringbuffer, | 2589 | 7.13k | ringbuffer_mask, | 2590 | 7.13k | ringbuffer_break, | 2591 | 7.13k | params, | 2592 | 7.13k | hasher, | 2593 | 7.13k | dist_cache, | 2594 | 7.13k | last_insert_len, | 2595 | 7.13k | commands, | 2596 | 7.13k | num_commands, | 2597 | 7.13k | num_literals, | 2598 | | ) | 2599 | | } else { | 2600 | 392 | super::backward_references_hq::BrotliCreateZopfliBackwardReferences( | 2601 | 392 | alloc, | 2602 | 392 | if params.use_dictionary { | 2603 | 392 | Some(dictionary) | 2604 | | } else { | 2605 | 0 | None | 2606 | | }, | 2607 | 392 | num_bytes, | 2608 | 392 | position, | 2609 | 392 | ringbuffer, | 2610 | 392 | ringbuffer_mask, | 2611 | 392 | ringbuffer_break, | 2612 | 392 | params, | 2613 | 392 | hasher, | 2614 | 392 | dist_cache, | 2615 | 392 | last_insert_len, | 2616 | 392 | commands, | 2617 | 392 | num_commands, | 2618 | 392 | num_literals, | 2619 | | ) | 2620 | | } | 2621 | | } | 2622 | 2.08k | &mut UnionHasher::H2(ref mut hasher) => CreateBackwardReferences( | 2623 | 2.08k | if params.use_dictionary { | 2624 | 2.08k | Some(dictionary) | 2625 | | } else { | 2626 | 0 | None | 2627 | | }, | 2628 | 2.08k | &kStaticDictionaryHash[..], | 2629 | 2.08k | num_bytes, | 2630 | 2.08k | position, | 2631 | 2.08k | ringbuffer, | 2632 | 2.08k | ringbuffer_mask, | 2633 | 2.08k | ringbuffer_break, | 2634 | 2.08k | params, | 2635 | 2.08k | hasher, | 2636 | 2.08k | dist_cache, | 2637 | 2.08k | last_insert_len, | 2638 | 2.08k | commands, | 2639 | 2.08k | num_commands, | 2640 | 2.08k | num_literals, | 2641 | | ), | 2642 | 1.29k | &mut UnionHasher::H3(ref mut hasher) => CreateBackwardReferences( | 2643 | 1.29k | if params.use_dictionary { | 2644 | 1.29k | Some(dictionary) | 2645 | | } else { | 2646 | 0 | None | 2647 | | }, | 2648 | 1.29k | &kStaticDictionaryHash[..], | 2649 | 1.29k | num_bytes, | 2650 | 1.29k | position, | 2651 | 1.29k | ringbuffer, | 2652 | 1.29k | ringbuffer_mask, | 2653 | 1.29k | ringbuffer_break, | 2654 | 1.29k | params, | 2655 | 1.29k | hasher, | 2656 | 1.29k | dist_cache, | 2657 | 1.29k | last_insert_len, | 2658 | 1.29k | commands, | 2659 | 1.29k | num_commands, | 2660 | 1.29k | num_literals, | 2661 | | ), | 2662 | 720 | &mut UnionHasher::H4(ref mut hasher) => CreateBackwardReferences( | 2663 | 720 | if params.use_dictionary { | 2664 | 720 | Some(dictionary) | 2665 | | } else { | 2666 | 0 | None | 2667 | | }, | 2668 | 720 | &kStaticDictionaryHash[..], | 2669 | 720 | num_bytes, | 2670 | 720 | position, | 2671 | 720 | ringbuffer, | 2672 | 720 | ringbuffer_mask, | 2673 | 720 | ringbuffer_break, | 2674 | 720 | params, | 2675 | 720 | hasher, | 2676 | 720 | dist_cache, | 2677 | 720 | last_insert_len, | 2678 | 720 | commands, | 2679 | 720 | num_commands, | 2680 | 720 | num_literals, | 2681 | | ), | 2682 | 740 | &mut UnionHasher::H5(ref mut hasher) => CreateBackwardReferences( | 2683 | 740 | if params.use_dictionary { | 2684 | 740 | Some(dictionary) | 2685 | | } else { | 2686 | 0 | None | 2687 | | }, | 2688 | 740 | &kStaticDictionaryHash[..], | 2689 | 740 | num_bytes, | 2690 | 740 | position, | 2691 | 740 | ringbuffer, | 2692 | 740 | ringbuffer_mask, | 2693 | 740 | ringbuffer_break, | 2694 | 740 | params, | 2695 | 740 | hasher, | 2696 | 740 | dist_cache, | 2697 | 740 | last_insert_len, | 2698 | 740 | commands, | 2699 | 740 | num_commands, | 2700 | 740 | num_literals, | 2701 | | ), | 2702 | 588 | &mut UnionHasher::H5q7(ref mut hasher) => CreateBackwardReferences( | 2703 | 588 | if params.use_dictionary { | 2704 | 588 | Some(dictionary) | 2705 | | } else { | 2706 | 0 | None | 2707 | | }, | 2708 | 588 | &kStaticDictionaryHash[..], | 2709 | 588 | num_bytes, | 2710 | 588 | position, | 2711 | 588 | ringbuffer, | 2712 | 588 | ringbuffer_mask, | 2713 | 588 | ringbuffer_break, | 2714 | 588 | params, | 2715 | 588 | hasher, | 2716 | 588 | dist_cache, | 2717 | 588 | last_insert_len, | 2718 | 588 | commands, | 2719 | 588 | num_commands, | 2720 | 588 | num_literals, | 2721 | | ), | 2722 | 698 | &mut UnionHasher::H5q5(ref mut hasher) => CreateBackwardReferences( | 2723 | 698 | if params.use_dictionary { | 2724 | 698 | Some(dictionary) | 2725 | | } else { | 2726 | 0 | None | 2727 | | }, | 2728 | 698 | &kStaticDictionaryHash[..], | 2729 | 698 | num_bytes, | 2730 | 698 | position, | 2731 | 698 | ringbuffer, | 2732 | 698 | ringbuffer_mask, | 2733 | 698 | ringbuffer_break, | 2734 | 698 | params, | 2735 | 698 | hasher, | 2736 | 698 | dist_cache, | 2737 | 698 | last_insert_len, | 2738 | 698 | commands, | 2739 | 698 | num_commands, | 2740 | 698 | num_literals, | 2741 | | ), | 2742 | 1.14k | &mut UnionHasher::H6(ref mut hasher) => CreateBackwardReferences( | 2743 | 1.14k | if params.use_dictionary { | 2744 | 1.14k | Some(dictionary) | 2745 | | } else { | 2746 | 0 | None | 2747 | | }, | 2748 | 1.14k | &kStaticDictionaryHash[..], | 2749 | 1.14k | num_bytes, | 2750 | 1.14k | position, | 2751 | 1.14k | ringbuffer, | 2752 | 1.14k | ringbuffer_mask, | 2753 | 1.14k | ringbuffer_break, | 2754 | 1.14k | params, | 2755 | 1.14k | hasher, | 2756 | 1.14k | dist_cache, | 2757 | 1.14k | last_insert_len, | 2758 | 1.14k | commands, | 2759 | 1.14k | num_commands, | 2760 | 1.14k | num_literals, | 2761 | | ), | 2762 | 637 | &mut UnionHasher::H9(ref mut hasher) => CreateBackwardReferences( | 2763 | 637 | if params.use_dictionary { | 2764 | 637 | Some(dictionary) | 2765 | | } else { | 2766 | 0 | None | 2767 | | }, | 2768 | 637 | &kStaticDictionaryHash[..], | 2769 | 637 | num_bytes, | 2770 | 637 | position, | 2771 | 637 | ringbuffer, | 2772 | 637 | ringbuffer_mask, | 2773 | 637 | ringbuffer_break, | 2774 | 637 | params, | 2775 | 637 | hasher, | 2776 | 637 | dist_cache, | 2777 | 637 | last_insert_len, | 2778 | 637 | commands, | 2779 | 637 | num_commands, | 2780 | 637 | num_literals, | 2781 | | ), | 2782 | 0 | &mut UnionHasher::H54(ref mut hasher) => CreateBackwardReferences( | 2783 | 0 | if params.use_dictionary { | 2784 | 0 | Some(dictionary) | 2785 | | } else { | 2786 | 0 | None | 2787 | | }, | 2788 | 0 | &kStaticDictionaryHash[..], | 2789 | 0 | num_bytes, | 2790 | 0 | position, | 2791 | 0 | ringbuffer, | 2792 | 0 | ringbuffer_mask, | 2793 | 0 | ringbuffer_break, | 2794 | 0 | params, | 2795 | 0 | hasher, | 2796 | 0 | dist_cache, | 2797 | 0 | last_insert_len, | 2798 | 0 | commands, | 2799 | 0 | num_commands, | 2800 | 0 | num_literals, | 2801 | | ), | 2802 | | } | 2803 | 15.4k | } |
Unexecuted instantiation: brotli::enc::backward_references::BrotliCreateBackwardReferences::<_> |