aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lz/lz_encoder.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-11-24 23:23:55 +0200
committerLasse Collin <lasse.collin@tukaani.org>2022-11-24 23:23:55 +0200
commit3be88ae071371caa279b44e13f4836fb178fe4ae (patch)
treeb5afaacaa76de62249c17531143d51c8962cc659 /src/liblzma/lz/lz_encoder.h
parentliblzma: Add lzma_filters_update() support to the multi-threaded encoder. (diff)
downloadxz-3be88ae071371caa279b44e13f4836fb178fe4ae.tar.xz
liblzma: Allow nice_len 2 and 3 even if match finder requires 3 or 4.
That is, if the specified nice_len is smaller than the minimum of the match finder, silently use the match finder's minimum value instead of reporting an error. The old behavior is annoying to users and it complicates xz options handling too.
Diffstat (limited to 'src/liblzma/lz/lz_encoder.h')
-rw-r--r--src/liblzma/lz/lz_encoder.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/liblzma/lz/lz_encoder.h b/src/liblzma/lz/lz_encoder.h
index e249beba..41439408 100644
--- a/src/liblzma/lz/lz_encoder.h
+++ b/src/liblzma/lz/lz_encoder.h
@@ -220,6 +220,15 @@ typedef struct {
// are called `read ahead'.
+/// Get how many bytes the match finder hashes in its initial step.
+/// This is also the minimum nice_len value with the match finder.
+static inline uint32_t
+mf_get_hash_bytes(lzma_match_finder match_finder)
+{
+ return (uint32_t)match_finder & 0x0F;
+}
+
+
/// Get pointer to the first byte not ran through the match finder
static inline const uint8_t *
mf_ptr(const lzma_mf *mf)