aboutsummaryrefslogtreecommitdiff
path: root/c/enc/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/enc/hash.h')
-rw-r--r--c/enc/hash.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/c/enc/hash.h b/c/enc/hash.h
index 4c94cda..f97d969 100644
--- a/c/enc/hash.h
+++ b/c/enc/hash.h
@@ -62,9 +62,9 @@ static const uint64_t kCutoffTransforms =
typedef struct HasherSearchResult {
size_t len;
- size_t len_x_code; /* == len ^ len_code */
size_t distance;
score_t score;
+ int len_code_delta; /* == len_code - len */
} HasherSearchResult;
/* kHashMul32 multiplier has these properties:
@@ -178,22 +178,21 @@ static BROTLI_INLINE BROTLI_BOOL TestStaticDictionaryItem(
return BROTLI_FALSE;
}
out->len = matchlen;
- out->len_x_code = len ^ matchlen;
+ out->len_code_delta = (int)len - (int)matchlen;
out->distance = backward;
out->score = score;
return BROTLI_TRUE;
}
-static BROTLI_INLINE BROTLI_BOOL SearchInStaticDictionary(
+static BROTLI_INLINE void SearchInStaticDictionary(
const BrotliDictionary* dictionary, const uint16_t* dictionary_hash,
HasherHandle handle, const uint8_t* data, size_t max_length,
size_t max_backward, HasherSearchResult* out, BROTLI_BOOL shallow) {
size_t key;
size_t i;
- BROTLI_BOOL is_match_found = BROTLI_FALSE;
HasherCommon* self = GetHasherCommon(handle);
if (self->dict_num_matches < (self->dict_num_lookups >> 7)) {
- return BROTLI_FALSE;
+ return;
}
key = Hash14(data) << 1;
for (i = 0; i < (shallow ? 1u : 2u); ++i, ++key) {
@@ -204,11 +203,9 @@ static BROTLI_INLINE BROTLI_BOOL SearchInStaticDictionary(
dictionary, item, data, max_length, max_backward, out);
if (item_matches) {
self->dict_num_matches++;
- is_match_found = BROTLI_TRUE;
}
}
}
- return is_match_found;
}
typedef struct BackwardMatch {