13#define HashComposite HASHER()
15#define FN_A(X) EXPAND_CAT(X, HASHER_A)
16#define FN_B(X) EXPAND_CAT(X, HASHER_B)
18static BROTLI_INLINE
size_t FN(HashTypeLength)(void) {
19 size_t a = FN_A(HashTypeLength)();
20 size_t b = FN_B(HashTypeLength)();
24static BROTLI_INLINE
size_t FN(StoreLookahead)(void) {
25 size_t a = FN_A(StoreLookahead)();
26 size_t b = FN_B(StoreLookahead)();
45 self->common = common;
47 self->ha_common = *self->common;
48 self->hb_common = *self->common;
50 self->params = params;
57static void FN(Prepare)(
59 size_t input_size,
const uint8_t* BROTLI_RESTRICT data) {
62 self->ha_common.extra[0] = self->common->extra[0];
63 self->ha_common.extra[1] = self->common->extra[1];
64 self->ha_common.extra[2] = NULL;
65 self->ha_common.extra[3] = NULL;
66 self->hb_common.extra[0] = self->common->extra[2];
67 self->hb_common.extra[1] = self->common->extra[3];
68 self->hb_common.extra[2] = NULL;
69 self->hb_common.extra[3] = NULL;
71 FN_A(Initialize)(&self->ha_common, &self->ha, self->params);
72 FN_B(Initialize)(&self->hb_common, &self->hb, self->params);
74 FN_A(Prepare)(&self->ha, one_shot, input_size, data);
75 FN_B(Prepare)(&self->hb, one_shot, input_size, data);
78static BROTLI_INLINE
void FN(HashMemAllocInBytes)(
80 size_t input_size,
size_t* alloc_size) {
81 size_t alloc_size_a[4] = {0};
82 size_t alloc_size_b[4] = {0};
83 FN_A(HashMemAllocInBytes)(params, one_shot, input_size, alloc_size_a);
84 FN_B(HashMemAllocInBytes)(params, one_shot, input_size, alloc_size_b);
86 if (alloc_size_a[2] != 0 || alloc_size_a[3] != 0) exit(EXIT_FAILURE);
87 if (alloc_size_b[2] != 0 || alloc_size_b[3] != 0) exit(EXIT_FAILURE);
88 alloc_size[0] = alloc_size_a[0];
89 alloc_size[1] = alloc_size_a[1];
90 alloc_size[2] = alloc_size_b[0];
91 alloc_size[3] = alloc_size_b[1];
94static BROTLI_INLINE
void FN(Store)(
HashComposite* BROTLI_RESTRICT self,
95 const uint8_t* BROTLI_RESTRICT data,
const size_t mask,
const size_t ix) {
96 FN_A(Store)(&self->ha, data, mask, ix);
97 FN_B(Store)(&self->hb, data, mask, ix);
100static BROTLI_INLINE
void FN(StoreRange)(
101 HashComposite* BROTLI_RESTRICT self,
const uint8_t* BROTLI_RESTRICT data,
102 const size_t mask,
const size_t ix_start,
103 const size_t ix_end) {
104 FN_A(StoreRange)(&self->ha, data, mask, ix_start, ix_end);
105 FN_B(StoreRange)(&self->hb, data, mask, ix_start, ix_end);
108static BROTLI_INLINE
void FN(StitchToPreviousBlock)(
110 size_t num_bytes,
size_t position,
const uint8_t* ringbuffer,
111 size_t ring_buffer_mask) {
112 FN_A(StitchToPreviousBlock)(&self->ha, num_bytes, position,
113 ringbuffer, ring_buffer_mask);
114 FN_B(StitchToPreviousBlock)(&self->hb, num_bytes, position,
115 ringbuffer, ring_buffer_mask);
118static BROTLI_INLINE
void FN(PrepareDistanceCache)(
119 HashComposite* BROTLI_RESTRICT self,
int* BROTLI_RESTRICT distance_cache) {
120 FN_A(PrepareDistanceCache)(&self->ha, distance_cache);
121 FN_B(PrepareDistanceCache)(&self->hb, distance_cache);
124static BROTLI_INLINE
void FN(FindLongestMatch)(
127 const uint8_t* BROTLI_RESTRICT data,
const size_t ring_buffer_mask,
128 const int* BROTLI_RESTRICT distance_cache,
const size_t cur_ix,
129 const size_t max_length,
const size_t max_backward,
130 const size_t dictionary_distance,
const size_t max_distance,
132 FN_A(FindLongestMatch)(&self->ha, dictionary, data, ring_buffer_mask,
133 distance_cache, cur_ix, max_length, max_backward, dictionary_distance,
135 FN_B(FindLongestMatch)(&self->hb, dictionary, data, ring_buffer_mask,
136 distance_cache, cur_ix, max_length, max_backward, dictionary_distance,
Definition: encoder_dict.h:61
Definition: hash_composite_inc.h:30
#define BROTLI_TRUE
Portable true replacement.
Definition: types.h:51
#define BROTLI_FALSE
Portable false replacement.
Definition: types.h:53
#define BROTLI_BOOL
A portable bool replacement.
Definition: types.h:49