/src/rust-brotli/src/enc/combined_alloc.rs
Line | Count | Source |
1 | | pub use alloc::Allocator; |
2 | | |
3 | | #[cfg(feature = "std")] |
4 | | use alloc_stdlib::StandardAlloc; |
5 | | |
6 | | use super::cluster::HistogramPair; |
7 | | use super::command::Command; |
8 | | use super::entropy_encode::HuffmanTree; |
9 | | use super::hash_to_binary_tree::ZopfliNode; |
10 | | use super::histogram::{ContextType, HistogramCommand, HistogramDistance, HistogramLiteral}; |
11 | | use super::interface::StaticCommand; |
12 | | use super::util::floatX; |
13 | | use super::{s16, v8, PDF}; |
14 | | /* |
15 | | struct CombiningAllocator<T1, T2, AllocT1:Allocator<T1>, AllocT2:Allocator<T2>>(AllocT1, AllocT2); |
16 | | |
17 | | impl <T1, T2, AllocT1:Allocator<T1>, AllocT2:Allocator<T2>> CombiningAllocator<T1, T2, AllocT1, AllocT2> { |
18 | | pub fn new(a: AllocT1, b: AllocT2) -> Self { |
19 | | CombiningAllocator(a, b) |
20 | | } |
21 | | } |
22 | | |
23 | | impl <T1, T2, AllocT1:Allocator<T1>, AllocT2:Allocator<T2>> Allocator<T1> for CombiningAllocator<T1, T2, AllocT1, AllocT2> { |
24 | | |
25 | | } |
26 | | |
27 | | |
28 | | impl <T1, T2, AllocT1:Allocator<T1>, AllocT2:Allocator<T2>> Allocator<T2> for CombiningAllocator<T1, T2, AllocT1, AllocT2> { |
29 | | |
30 | | } |
31 | | */ |
32 | | |
33 | | pub trait BrotliAlloc: |
34 | | Allocator<u8> |
35 | | + Allocator<u16> |
36 | | + Allocator<i32> |
37 | | + Allocator<u32> |
38 | | + Allocator<u64> |
39 | | + Allocator<Command> |
40 | | + Allocator<super::util::floatX> |
41 | | + Allocator<v8> |
42 | | + Allocator<s16> |
43 | | + Allocator<PDF> |
44 | | + Allocator<StaticCommand> |
45 | | + Allocator<HistogramLiteral> |
46 | | + Allocator<HistogramCommand> |
47 | | + Allocator<HistogramDistance> |
48 | | + Allocator<HistogramPair> |
49 | | + Allocator<ContextType> |
50 | | + Allocator<HuffmanTree> |
51 | | + Allocator<ZopfliNode> |
52 | | { |
53 | | } |
54 | | |
55 | | #[cfg(feature = "std")] |
56 | | impl BrotliAlloc for StandardAlloc {} |
57 | | |
58 | | pub struct CombiningAllocator< |
59 | | AllocU8: Allocator<u8>, |
60 | | AllocU16: Allocator<u16>, |
61 | | AllocI32: Allocator<i32>, |
62 | | AllocU32: Allocator<u32>, |
63 | | AllocU64: Allocator<u64>, |
64 | | AllocCommand: Allocator<Command>, |
65 | | AllocFloatX: Allocator<floatX>, |
66 | | AllocV8: Allocator<v8>, |
67 | | AllocS16: Allocator<s16>, |
68 | | AllocPDF: Allocator<PDF>, |
69 | | AllocStaticCommand: Allocator<StaticCommand>, |
70 | | AllocHistogramLiteral: Allocator<HistogramLiteral>, |
71 | | AllocHistogramCommand: Allocator<HistogramCommand>, |
72 | | AllocHistogramDistance: Allocator<HistogramDistance>, |
73 | | AllocHistogramPair: Allocator<HistogramPair>, |
74 | | AllocContextType: Allocator<ContextType>, |
75 | | AllocHuffmanTree: Allocator<HuffmanTree>, |
76 | | AllocZopfliNode: Allocator<ZopfliNode>, |
77 | | > { |
78 | | alloc_u8: AllocU8, |
79 | | alloc_u16: AllocU16, |
80 | | alloc_i32: AllocI32, |
81 | | alloc_u32: AllocU32, |
82 | | alloc_u64: AllocU64, |
83 | | alloc_c: AllocCommand, |
84 | | alloc_f: AllocFloatX, |
85 | | alloc_f32x8: AllocV8, |
86 | | alloc_i16x16: AllocS16, |
87 | | alloc_pdf: AllocPDF, |
88 | | alloc_sc: AllocStaticCommand, |
89 | | alloc_hl: AllocHistogramLiteral, |
90 | | alloc_hc: AllocHistogramCommand, |
91 | | alloc_hd: AllocHistogramDistance, |
92 | | alloc_hp: AllocHistogramPair, |
93 | | alloc_ct: AllocContextType, |
94 | | alloc_ht: AllocHuffmanTree, |
95 | | alloc_zn: AllocZopfliNode, |
96 | | } |
97 | | |
98 | | impl< |
99 | | AllocU8: Allocator<u8>, |
100 | | AllocU16: Allocator<u16>, |
101 | | AllocI32: Allocator<i32>, |
102 | | AllocU32: Allocator<u32>, |
103 | | AllocU64: Allocator<u64>, |
104 | | AllocCommand: Allocator<Command>, |
105 | | AllocFloatX: Allocator<floatX>, |
106 | | AllocV8: Allocator<v8>, |
107 | | AllocS16: Allocator<s16>, |
108 | | AllocPDF: Allocator<PDF>, |
109 | | AllocStaticCommand: Allocator<StaticCommand>, |
110 | | AllocHistogramLiteral: Allocator<HistogramLiteral>, |
111 | | AllocHistogramCommand: Allocator<HistogramCommand>, |
112 | | AllocHistogramDistance: Allocator<HistogramDistance>, |
113 | | AllocHistogramPair: Allocator<HistogramPair>, |
114 | | AllocContextType: Allocator<ContextType>, |
115 | | AllocHuffmanTree: Allocator<HuffmanTree>, |
116 | | AllocZopfliNode: Allocator<ZopfliNode>, |
117 | | > |
118 | | CombiningAllocator< |
119 | | AllocU8, |
120 | | AllocU16, |
121 | | AllocI32, |
122 | | AllocU32, |
123 | | AllocU64, |
124 | | AllocCommand, |
125 | | AllocFloatX, |
126 | | AllocV8, |
127 | | AllocS16, |
128 | | AllocPDF, |
129 | | AllocStaticCommand, |
130 | | AllocHistogramLiteral, |
131 | | AllocHistogramCommand, |
132 | | AllocHistogramDistance, |
133 | | AllocHistogramPair, |
134 | | AllocContextType, |
135 | | AllocHuffmanTree, |
136 | | AllocZopfliNode, |
137 | | > |
138 | | { |
139 | 0 | pub fn new( |
140 | 0 | alloc_u8: AllocU8, |
141 | 0 | alloc_u16: AllocU16, |
142 | 0 | alloc_i32: AllocI32, |
143 | 0 | alloc_u32: AllocU32, |
144 | 0 | alloc_u64: AllocU64, |
145 | 0 | alloc_c: AllocCommand, |
146 | 0 | alloc_f: AllocFloatX, |
147 | 0 | alloc_f32x8: AllocV8, |
148 | 0 | alloc_i16x16: AllocS16, |
149 | 0 | alloc_pdf: AllocPDF, |
150 | 0 | alloc_sc: AllocStaticCommand, |
151 | 0 | alloc_hl: AllocHistogramLiteral, |
152 | 0 | alloc_hc: AllocHistogramCommand, |
153 | 0 | alloc_hd: AllocHistogramDistance, |
154 | 0 | alloc_hp: AllocHistogramPair, |
155 | 0 | alloc_ct: AllocContextType, |
156 | 0 | alloc_ht: AllocHuffmanTree, |
157 | 0 | alloc_zn: AllocZopfliNode, |
158 | 0 | ) -> Self { |
159 | 0 | CombiningAllocator { |
160 | 0 | alloc_u8, |
161 | 0 | alloc_u16, |
162 | 0 | alloc_i32, |
163 | 0 | alloc_u32, |
164 | 0 | alloc_u64, |
165 | 0 | alloc_c, |
166 | 0 | alloc_f, |
167 | 0 | alloc_f32x8, |
168 | 0 | alloc_i16x16, |
169 | 0 | alloc_pdf, |
170 | 0 | alloc_sc, |
171 | 0 | alloc_hl, |
172 | 0 | alloc_hc, |
173 | 0 | alloc_hd, |
174 | 0 | alloc_hp, |
175 | 0 | alloc_ct, |
176 | 0 | alloc_ht, |
177 | 0 | alloc_zn, |
178 | 0 | } |
179 | 0 | } |
180 | | } |
181 | | |
182 | | impl< |
183 | | AllocU8: Allocator<u8>, |
184 | | AllocU16: Allocator<u16>, |
185 | | AllocI32: Allocator<i32>, |
186 | | AllocU32: Allocator<u32>, |
187 | | AllocU64: Allocator<u64>, |
188 | | AllocCommand: Allocator<Command>, |
189 | | AllocFloatX: Allocator<floatX>, |
190 | | AllocV8: Allocator<v8>, |
191 | | AllocS16: Allocator<s16>, |
192 | | AllocPDF: Allocator<PDF>, |
193 | | AllocStaticCommand: Allocator<StaticCommand>, |
194 | | AllocHistogramLiteral: Allocator<HistogramLiteral>, |
195 | | AllocHistogramCommand: Allocator<HistogramCommand>, |
196 | | AllocHistogramDistance: Allocator<HistogramDistance>, |
197 | | AllocHistogramPair: Allocator<HistogramPair>, |
198 | | AllocContextType: Allocator<ContextType>, |
199 | | AllocHuffmanTree: Allocator<HuffmanTree>, |
200 | | AllocZopfliNode: Allocator<ZopfliNode>, |
201 | | > BrotliAlloc |
202 | | for CombiningAllocator< |
203 | | AllocU8, |
204 | | AllocU16, |
205 | | AllocI32, |
206 | | AllocU32, |
207 | | AllocU64, |
208 | | AllocCommand, |
209 | | AllocFloatX, |
210 | | AllocV8, |
211 | | AllocS16, |
212 | | AllocPDF, |
213 | | AllocStaticCommand, |
214 | | AllocHistogramLiteral, |
215 | | AllocHistogramCommand, |
216 | | AllocHistogramDistance, |
217 | | AllocHistogramPair, |
218 | | AllocContextType, |
219 | | AllocHuffmanTree, |
220 | | AllocZopfliNode, |
221 | | > |
222 | | { |
223 | | } |
224 | | |
225 | | impl< |
226 | | AllocU8: Allocator<u8> + Default, |
227 | | AllocU16: Allocator<u16> + Default, |
228 | | AllocI32: Allocator<i32> + Default, |
229 | | AllocU32: Allocator<u32> + Default, |
230 | | AllocU64: Allocator<u64> + Default, |
231 | | AllocCommand: Allocator<Command> + Default, |
232 | | AllocFloatX: Allocator<floatX> + Default, |
233 | | AllocV8: Allocator<v8> + Default, |
234 | | AllocS16: Allocator<s16> + Default, |
235 | | AllocPDF: Allocator<PDF> + Default, |
236 | | AllocStaticCommand: Allocator<StaticCommand> + Default, |
237 | | AllocHistogramLiteral: Allocator<HistogramLiteral> + Default, |
238 | | AllocHistogramCommand: Allocator<HistogramCommand> + Default, |
239 | | AllocHistogramDistance: Allocator<HistogramDistance> + Default, |
240 | | AllocHistogramPair: Allocator<HistogramPair> + Default, |
241 | | AllocContextType: Allocator<ContextType> + Default, |
242 | | AllocHuffmanTree: Allocator<HuffmanTree> + Default, |
243 | | AllocZopfliNode: Allocator<ZopfliNode> + Default, |
244 | | > Default |
245 | | for CombiningAllocator< |
246 | | AllocU8, |
247 | | AllocU16, |
248 | | AllocI32, |
249 | | AllocU32, |
250 | | AllocU64, |
251 | | AllocCommand, |
252 | | AllocFloatX, |
253 | | AllocV8, |
254 | | AllocS16, |
255 | | AllocPDF, |
256 | | AllocStaticCommand, |
257 | | AllocHistogramLiteral, |
258 | | AllocHistogramCommand, |
259 | | AllocHistogramDistance, |
260 | | AllocHistogramPair, |
261 | | AllocContextType, |
262 | | AllocHuffmanTree, |
263 | | AllocZopfliNode, |
264 | | > |
265 | | { |
266 | 0 | fn default() -> Self { |
267 | 0 | CombiningAllocator { |
268 | 0 | alloc_u8: AllocU8::default(), |
269 | 0 | alloc_u16: AllocU16::default(), |
270 | 0 | alloc_i32: AllocI32::default(), |
271 | 0 | alloc_u32: AllocU32::default(), |
272 | 0 | alloc_u64: AllocU64::default(), |
273 | 0 | alloc_c: AllocCommand::default(), |
274 | 0 | alloc_f: AllocFloatX::default(), |
275 | 0 | alloc_f32x8: AllocV8::default(), |
276 | 0 | alloc_i16x16: AllocS16::default(), |
277 | 0 | alloc_pdf: AllocPDF::default(), |
278 | 0 | alloc_sc: AllocStaticCommand::default(), |
279 | 0 | alloc_hl: AllocHistogramLiteral::default(), |
280 | 0 | alloc_hc: AllocHistogramCommand::default(), |
281 | 0 | alloc_hd: AllocHistogramDistance::default(), |
282 | 0 | alloc_hp: AllocHistogramPair::default(), |
283 | 0 | alloc_ct: AllocContextType::default(), |
284 | 0 | alloc_ht: AllocHuffmanTree::default(), |
285 | 0 | alloc_zn: AllocZopfliNode::default(), |
286 | 0 | } |
287 | 0 | } |
288 | | } |
289 | | |
290 | | impl< |
291 | | AllocU8: Allocator<u8> + Clone, |
292 | | AllocU16: Allocator<u16> + Clone, |
293 | | AllocI32: Allocator<i32> + Clone, |
294 | | AllocU32: Allocator<u32> + Clone, |
295 | | AllocU64: Allocator<u64> + Clone, |
296 | | AllocCommand: Allocator<Command> + Clone, |
297 | | AllocFloatX: Allocator<floatX> + Clone, |
298 | | AllocV8: Allocator<v8> + Clone, |
299 | | AllocS16: Allocator<s16> + Clone, |
300 | | AllocPDF: Allocator<PDF> + Clone, |
301 | | AllocStaticCommand: Allocator<StaticCommand> + Clone, |
302 | | AllocHistogramLiteral: Allocator<HistogramLiteral> + Clone, |
303 | | AllocHistogramCommand: Allocator<HistogramCommand> + Clone, |
304 | | AllocHistogramDistance: Allocator<HistogramDistance> + Clone, |
305 | | AllocHistogramPair: Allocator<HistogramPair> + Clone, |
306 | | AllocContextType: Allocator<ContextType> + Clone, |
307 | | AllocHuffmanTree: Allocator<HuffmanTree> + Clone, |
308 | | AllocZopfliNode: Allocator<ZopfliNode> + Clone, |
309 | | > Clone |
310 | | for CombiningAllocator< |
311 | | AllocU8, |
312 | | AllocU16, |
313 | | AllocI32, |
314 | | AllocU32, |
315 | | AllocU64, |
316 | | AllocCommand, |
317 | | AllocFloatX, |
318 | | AllocV8, |
319 | | AllocS16, |
320 | | AllocPDF, |
321 | | AllocStaticCommand, |
322 | | AllocHistogramLiteral, |
323 | | AllocHistogramCommand, |
324 | | AllocHistogramDistance, |
325 | | AllocHistogramPair, |
326 | | AllocContextType, |
327 | | AllocHuffmanTree, |
328 | | AllocZopfliNode, |
329 | | > |
330 | | { |
331 | 0 | fn clone(&self) -> Self { |
332 | 0 | CombiningAllocator { |
333 | 0 | alloc_u8: self.alloc_u8.clone(), |
334 | 0 | alloc_u16: self.alloc_u16.clone(), |
335 | 0 | alloc_i32: self.alloc_i32.clone(), |
336 | 0 | alloc_u32: self.alloc_u32.clone(), |
337 | 0 | alloc_u64: self.alloc_u64.clone(), |
338 | 0 | alloc_c: self.alloc_c.clone(), |
339 | 0 | alloc_f: self.alloc_f.clone(), |
340 | 0 | alloc_f32x8: self.alloc_f32x8.clone(), |
341 | 0 | alloc_i16x16: self.alloc_i16x16.clone(), |
342 | 0 | alloc_pdf: self.alloc_pdf.clone(), |
343 | 0 | alloc_sc: self.alloc_sc.clone(), |
344 | 0 | alloc_hl: self.alloc_hl.clone(), |
345 | 0 | alloc_hc: self.alloc_hc.clone(), |
346 | 0 | alloc_hd: self.alloc_hd.clone(), |
347 | 0 | alloc_hp: self.alloc_hp.clone(), |
348 | 0 | alloc_ct: self.alloc_ct.clone(), |
349 | 0 | alloc_ht: self.alloc_ht.clone(), |
350 | 0 | alloc_zn: self.alloc_zn.clone(), |
351 | 0 | } |
352 | 0 | } |
353 | | } |
354 | | |
355 | | impl< |
356 | | AllocU8: Allocator<u8> + Copy, |
357 | | AllocU16: Allocator<u16> + Copy, |
358 | | AllocI32: Allocator<i32> + Copy, |
359 | | AllocU32: Allocator<u32> + Copy, |
360 | | AllocU64: Allocator<u64> + Copy, |
361 | | AllocCommand: Allocator<Command> + Copy, |
362 | | AllocFloatX: Allocator<floatX> + Copy, |
363 | | AllocV8: Allocator<v8> + Copy, |
364 | | AllocS16: Allocator<s16> + Copy, |
365 | | AllocPDF: Allocator<PDF> + Copy, |
366 | | AllocStaticCommand: Allocator<StaticCommand> + Copy, |
367 | | AllocHistogramLiteral: Allocator<HistogramLiteral> + Copy, |
368 | | AllocHistogramCommand: Allocator<HistogramCommand> + Copy, |
369 | | AllocHistogramDistance: Allocator<HistogramDistance> + Copy, |
370 | | AllocHistogramPair: Allocator<HistogramPair> + Copy, |
371 | | AllocContextType: Allocator<ContextType> + Copy, |
372 | | AllocHuffmanTree: Allocator<HuffmanTree> + Copy, |
373 | | AllocZopfliNode: Allocator<ZopfliNode> + Copy, |
374 | | > Copy |
375 | | for CombiningAllocator< |
376 | | AllocU8, |
377 | | AllocU16, |
378 | | AllocI32, |
379 | | AllocU32, |
380 | | AllocU64, |
381 | | AllocCommand, |
382 | | AllocFloatX, |
383 | | AllocV8, |
384 | | AllocS16, |
385 | | AllocPDF, |
386 | | AllocStaticCommand, |
387 | | AllocHistogramLiteral, |
388 | | AllocHistogramCommand, |
389 | | AllocHistogramDistance, |
390 | | AllocHistogramPair, |
391 | | AllocContextType, |
392 | | AllocHuffmanTree, |
393 | | AllocZopfliNode, |
394 | | > |
395 | | { |
396 | | } |
397 | | |
398 | | macro_rules! implement_allocator { |
399 | | ($bound_name: ty, |
400 | | $type_name: ty, |
401 | | $sub_type_name: ty, |
402 | | $local_name: ident) => { |
403 | | impl< |
404 | | AllocU8: Allocator<u8>, |
405 | | AllocU16: Allocator<u16>, |
406 | | AllocI32: Allocator<i32>, |
407 | | AllocU32: Allocator<u32>, |
408 | | AllocU64: Allocator<u64>, |
409 | | AllocCommand: Allocator<Command>, |
410 | | AllocFloatX: Allocator<floatX>, |
411 | | AllocV8: Allocator<v8>, |
412 | | AllocS16: Allocator<s16>, |
413 | | AllocPDF: Allocator<PDF>, |
414 | | AllocStaticCommand: Allocator<StaticCommand>, |
415 | | AllocHistogramLiteral: Allocator<HistogramLiteral>, |
416 | | AllocHistogramCommand: Allocator<HistogramCommand>, |
417 | | AllocHistogramDistance: Allocator<HistogramDistance>, |
418 | | AllocHistogramPair: Allocator<HistogramPair>, |
419 | | AllocContextType: Allocator<ContextType>, |
420 | | AllocHuffmanTree: Allocator<HuffmanTree>, |
421 | | AllocZopfliNode: Allocator<ZopfliNode>, |
422 | | > Allocator<$type_name> |
423 | | for CombiningAllocator< |
424 | | AllocU8, |
425 | | AllocU16, |
426 | | AllocI32, |
427 | | AllocU32, |
428 | | AllocU64, |
429 | | AllocCommand, |
430 | | AllocFloatX, |
431 | | AllocV8, |
432 | | AllocS16, |
433 | | AllocPDF, |
434 | | AllocStaticCommand, |
435 | | AllocHistogramLiteral, |
436 | | AllocHistogramCommand, |
437 | | AllocHistogramDistance, |
438 | | AllocHistogramPair, |
439 | | AllocContextType, |
440 | | AllocHuffmanTree, |
441 | | AllocZopfliNode, |
442 | | > |
443 | | { |
444 | | type AllocatedMemory = $sub_type_name; |
445 | 0 | fn alloc_cell( |
446 | 0 | &mut self, |
447 | 0 | size: usize, |
448 | 0 | ) -> <Self as Allocator<$type_name>>::AllocatedMemory { |
449 | 0 | self.$local_name.alloc_cell(size) |
450 | 0 | } Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u8>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u16>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<i32>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u32>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u64>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::command::Command>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<f32>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::compat::CompatF8>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::compat::Compat16x16>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::pdf::PDF>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::HistogramLiteral>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::HistogramCommand>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::HistogramDistance>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::cluster::HistogramPair>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::ContextType>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::entropy_encode::HuffmanTree>>::alloc_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode>>::alloc_cell |
451 | 0 | fn free_cell(&mut self, data: <Self as Allocator<$type_name>>::AllocatedMemory) { |
452 | 0 | self.$local_name.free_cell(data) |
453 | 0 | } Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u8>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u16>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<i32>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u32>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<u64>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::command::Command>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<f32>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::compat::CompatF8>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::compat::Compat16x16>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::pdf::PDF>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::HistogramLiteral>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::HistogramCommand>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::HistogramDistance>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::cluster::HistogramPair>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::histogram::ContextType>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::entropy_encode::HuffmanTree>>::free_cell Unexecuted instantiation: <brotli::enc::combined_alloc::CombiningAllocator<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as alloc_no_stdlib::stack_allocator::Allocator<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode>>::free_cell |
454 | | } |
455 | | }; |
456 | | } |
457 | | |
458 | | implement_allocator!(AllocU8, u8, AllocU8::AllocatedMemory, alloc_u8); |
459 | | implement_allocator!(AllocU16, u16, AllocU16::AllocatedMemory, alloc_u16); |
460 | | |
461 | | implement_allocator!(AllocI32, i32, AllocI32::AllocatedMemory, alloc_i32); |
462 | | implement_allocator!(AllocU32, u32, AllocU32::AllocatedMemory, alloc_u32); |
463 | | implement_allocator!(AllocU64, u64, AllocU64::AllocatedMemory, alloc_u64); |
464 | | implement_allocator!( |
465 | | AllocCommand, |
466 | | Command, |
467 | | AllocCommand::AllocatedMemory, |
468 | | alloc_c |
469 | | ); |
470 | | implement_allocator!(AllocFloatX, floatX, AllocFloatX::AllocatedMemory, alloc_f); |
471 | | implement_allocator!(AllocV8, v8, AllocV8::AllocatedMemory, alloc_f32x8); |
472 | | implement_allocator!(AllocS16, s16, AllocS16::AllocatedMemory, alloc_i16x16); |
473 | | implement_allocator!(AllocPDF, PDF, AllocPDF::AllocatedMemory, alloc_pdf); |
474 | | implement_allocator!( |
475 | | AllocStaticCommand, |
476 | | StaticCommand, |
477 | | AllocStaticCommand::AllocatedMemory, |
478 | | alloc_sc |
479 | | ); |
480 | | implement_allocator!( |
481 | | AllocHistogramLiteral, |
482 | | HistogramLiteral, |
483 | | AllocHistogramLiteral::AllocatedMemory, |
484 | | alloc_hl |
485 | | ); |
486 | | implement_allocator!( |
487 | | AllocHistogramCommand, |
488 | | HistogramCommand, |
489 | | AllocHistogramCommand::AllocatedMemory, |
490 | | alloc_hc |
491 | | ); |
492 | | implement_allocator!( |
493 | | AllocHistogramDistance, |
494 | | HistogramDistance, |
495 | | AllocHistogramDistance::AllocatedMemory, |
496 | | alloc_hd |
497 | | ); |
498 | | implement_allocator!( |
499 | | AllocHistogramPair, |
500 | | HistogramPair, |
501 | | AllocHistogramPair::AllocatedMemory, |
502 | | alloc_hp |
503 | | ); |
504 | | implement_allocator!( |
505 | | AllocContextType, |
506 | | ContextType, |
507 | | AllocContextType::AllocatedMemory, |
508 | | alloc_ct |
509 | | ); |
510 | | implement_allocator!( |
511 | | AllocHuffmanTree, |
512 | | HuffmanTree, |
513 | | AllocHuffmanTree::AllocatedMemory, |
514 | | alloc_ht |
515 | | ); |
516 | | implement_allocator!( |
517 | | AllocZopfliNode, |
518 | | ZopfliNode, |
519 | | AllocZopfliNode::AllocatedMemory, |
520 | | alloc_zn |
521 | | ); |
522 | | |
523 | | /// Helper function to allocate memory with the given allocator (may crash if the `len` is 0). |
524 | 0 | pub(crate) fn allocate<T, A: Allocator<T>>(alloc: &mut A, len: usize) -> A::AllocatedMemory { |
525 | 0 | A::alloc_cell(alloc, len) |
526 | 0 | } Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::entropy_encode::HuffmanTree, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::compat::Compat16x16, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::compat::CompatF8, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::cluster::HistogramPair, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::command::Command, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::histogram::ContextType, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::histogram::HistogramCommand, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::histogram::HistogramLiteral, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::histogram::HistogramDistance, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<f32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<u8, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<u32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<u16, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<u64, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::allocate::<_, _> |
527 | | |
528 | | /// Helper function to create an empty allocator object |
529 | 0 | pub(crate) fn alloc_default<T, A: Allocator<T>>() -> A::AllocatedMemory { |
530 | 0 | A::AllocatedMemory::default() |
531 | 0 | } Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::entropy_encode::HuffmanTree, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::compat::Compat16x16, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::compat::CompatF8, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::cluster::HistogramPair, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::command::Command, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::histogram::ContextType, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::histogram::HistogramCommand, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::histogram::HistogramLiteral, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::histogram::HistogramDistance, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<f32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<u8, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<i32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<u32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<u16, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<u64, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_default::<_, _> |
532 | | |
533 | | /// Helper function to allocate memory or return a default value if the condition is false |
534 | 0 | pub(crate) fn alloc_if<T, A: Allocator<T>>( |
535 | 0 | condition: bool, |
536 | 0 | alloc: &mut A, |
537 | 0 | len: usize, |
538 | 0 | ) -> A::AllocatedMemory { |
539 | 0 | if condition { |
540 | 0 | allocate(alloc, len) |
541 | | } else { |
542 | 0 | alloc_default::<T, A>() |
543 | | } |
544 | 0 | } Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<brotli::enc::entropy_encode::HuffmanTree, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<brotli::enc::compat::Compat16x16, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<brotli::enc::compat::CompatF8, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<brotli::enc::cluster::HistogramPair, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<brotli::enc::histogram::HistogramLiteral, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<brotli::enc::histogram::HistogramDistance, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<f32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<u8, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<u32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<u16, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<u64, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_if::<_, _> |
545 | | |
546 | | /// Helper function to allocate memory or return a default value when the size is 0. |
547 | 0 | pub(crate) fn alloc_or_default<T, A: Allocator<T>>( |
548 | 0 | alloc: &mut A, |
549 | 0 | len: usize, |
550 | 0 | ) -> A::AllocatedMemory { |
551 | 0 | alloc_if(len > 0, alloc, len) |
552 | 0 | } Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<brotli::enc::entropy_encode::HuffmanTree, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<brotli::enc::cluster::HistogramPair, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<brotli::enc::histogram::HistogramLiteral, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<brotli::enc::histogram::HistogramDistance, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<f32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<u8, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<u32, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<u16, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<u64, alloc_stdlib::std_alloc::StandardAlloc> Unexecuted instantiation: brotli::enc::combined_alloc::alloc_or_default::<_, _> |