Lines Matching +full:- +full:15 +full:v

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Implementation of the LZ77 "plain" compression algorithm, as per MS-XCA spec.
22 #define LZ77_HASH_LOG 15
36 static __always_inline void lz77_write8(u8 *ptr, u8 v) in lz77_write8() argument
38 put_unaligned(v, ptr); in lz77_write8()
41 static __always_inline void lz77_write16(u16 *ptr, u16 v) in lz77_write16() argument
43 put_unaligned_le16(v, ptr); in lz77_write16()
46 static __always_inline void lz77_write32(u32 *ptr, u32 v) in lz77_write32() argument
48 put_unaligned_le32(v, ptr); in lz77_write32()
69 return (cur - start); in lz77_match_len()
75 return (cur - start); in lz77_match_len()
80 len -= 3; in lz77_write_match()
81 dist--; in lz77_write_match()
93 len -= 7; in lz77_write_match()
96 lz77_write8(dst, umin(len, 15)); in lz77_write_match()
102 lz77_write8(b, *b | umin(len, 15) << 4); in lz77_write_match()
106 if (len < 15) in lz77_write_match()
109 len -= 15; in lz77_write_match()
118 len += 7 + 15; in lz77_write_match()
149 return -ENOMEM; in lz77_compress()
157 hash = ((lz77_read64(srcp) << 24) * 889523592379ULL) >> (64 - LZ77_HASH_LOG); in lz77_compress()
159 htable[hash] = srcp - src; in lz77_compress()
160 dist = srcp - wnd; in lz77_compress()
184 * Bail out if @dstp reached >= 7/8 of @slen -- already compressed badly, not worth in lz77_compress()
187 if (unlikely(dstp - dst >= slen - (slen >> 3))) { in lz77_compress()
206 u32 c = umin(end - srcp, 32 - flag_count); in lz77_compress()
223 flag <<= (32 - flag_count); in lz77_compress()
224 flag |= (1 << (32 - flag_count)) - 1; in lz77_compress()
227 *dlen = dstp - dst; in lz77_compress()
234 return -EMSGSIZE; in lz77_compress()