Skip to content

Commit 4901706

Browse files
committed
Simplify static_dict
* Convert `IsMatch(dict, ...)` into a member method. The original `IsMatch` is marked as deprecated - and we probably can delete it, but it will require a major release due to being a breaking change. So for now, lets keep it, but remove it when releasing a new breaking version * Same for `BrotliFindAllStaticDictionaryMatches` * lots of internal simplifications - like using direct comparisons, using bools, etc
1 parent dac157a commit 4901706

File tree

2 files changed

+435
-489
lines changed

2 files changed

+435
-489
lines changed

src/enc/backward_references/hq.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ use crate::enc::constants::{kCopyExtra, kInsExtra};
2020
use crate::enc::encode;
2121
use crate::enc::literal_cost::BrotliEstimateBitCostsForLiterals;
2222
use crate::enc::static_dict::{
23-
BrotliDictionary, BrotliFindAllStaticDictionaryMatches, FindMatchLengthWithLimit,
24-
BROTLI_UNALIGNED_LOAD32,
23+
BrotliDictionary, FindMatchLengthWithLimit, BROTLI_UNALIGNED_LOAD32,
2524
};
2625
use crate::enc::util::{floatX, FastLog2, FastLog2f64};
2726

@@ -382,13 +381,12 @@ where
382381
{
383382
let minlen = max(4, best_len.wrapping_add(1));
384383
if dictionary.is_some()
385-
&& BrotliFindAllStaticDictionaryMatches(
386-
dictionary.unwrap(),
384+
&& dictionary.unwrap().find_all_matches(
387385
&data[cur_ix_masked..],
388386
minlen,
389387
max_length,
390388
&mut dict_matches[..],
391-
) != 0
389+
)
392390
{
393391
assert!(params.use_dictionary);
394392
let maxlen = min(37, max_length);

0 commit comments

Comments
 (0)