Lines Matching +full:ctrl +full:- +full:len

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>
6 * Redistribution and use in source and binary forms, with or without modifica-
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
53 # define IDX(h) ((( h >> (3*8 - HLOG)) - h ) & (HSIZE - 1))
55 # define IDX(h) ((( h >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
57 # define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
62 * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1))
70 /* original lzv-like hash function, much worse and thus slower */
73 # define IDX(h) ((h) & (HSIZE - 1))
121 * bit pattern traps. Since the only platform that is both non-POSIX in lzf_compress()
147 while (ip < in_end - 2) in lzf_compress()
157 && (off = ip - ref - 1) < MAX_OFF in lzf_compress()
171 unsigned int len = 2; in lzf_compress() local
172 unsigned int maxlen = in_end - ip - len; in lzf_compress()
176 if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */ in lzf_compress()
179 op [- lit - 1] = lit - 1; /* stop run */ in lzf_compress()
180 op -= !lit; /* undo run if length is zero */ in lzf_compress()
186 len++; if (ref [len] != ip [len]) break; in lzf_compress()
187 len++; if (ref [len] != ip [len]) break; in lzf_compress()
188 len++; if (ref [len] != ip [len]) break; in lzf_compress()
189 len++; if (ref [len] != ip [len]) break; in lzf_compress()
191 len++; if (ref [len] != ip [len]) break; in lzf_compress()
192 len++; if (ref [len] != ip [len]) break; in lzf_compress()
193 len++; if (ref [len] != ip [len]) break; in lzf_compress()
194 len++; if (ref [len] != ip [len]) break; in lzf_compress()
196 len++; if (ref [len] != ip [len]) break; in lzf_compress()
197 len++; if (ref [len] != ip [len]) break; in lzf_compress()
198 len++; if (ref [len] != ip [len]) break; in lzf_compress()
199 len++; if (ref [len] != ip [len]) break; in lzf_compress()
201 len++; if (ref [len] != ip [len]) break; in lzf_compress()
202 len++; if (ref [len] != ip [len]) break; in lzf_compress()
203 len++; if (ref [len] != ip [len]) break; in lzf_compress()
204 len++; if (ref [len] != ip [len]) break; in lzf_compress()
208 len++; in lzf_compress()
209 while (len < maxlen && ref[len] == ip[len]); in lzf_compress()
214 len -= 2; /* len is now #octets - 1 */ in lzf_compress()
217 if (len < 7) in lzf_compress()
219 *op++ = (off >> 8) + (len << 5); in lzf_compress()
224 *op++ = len - 7; in lzf_compress()
230 ip += len + 1; in lzf_compress()
232 if (expect_false (ip >= in_end - 2)) in lzf_compress()
236 --ip; in lzf_compress()
238 --ip; in lzf_compress()
252 ip -= len + 1; in lzf_compress()
260 while (len--); in lzf_compress()
273 op [- lit - 1] = lit - 1; /* stop run */ in lzf_compress()
288 op [- lit - 1] = lit - 1; /* stop run */ in lzf_compress()
293 op [- lit - 1] = lit - 1; /* end run */ in lzf_compress()
294 op -= !lit; /* undo run if length is zero */ in lzf_compress()
296 return op - (u8 *)out_data; in lzf_compress()
307 # define lzf_movsb(dst, src, len) \ argument
309 : "=D" (dst), "=S" (src), "=c" (len) \
310 : "0" (dst), "1" (src), "2" (len));
324 unsigned int ctrl = *ip++; in lzf_decompress() local
326 if (ctrl < (1 << 5)) /* literal run */ in lzf_decompress()
328 ctrl++; in lzf_decompress()
330 if (op + ctrl > out_end) in lzf_decompress()
337 if (ip + ctrl > in_end) in lzf_decompress()
345 lzf_movsb (op, ip, ctrl); in lzf_decompress()
349 while (--ctrl); in lzf_decompress()
354 unsigned int len = ctrl >> 5; in lzf_decompress() local
356 u8 *ref = op - ((ctrl & 0x1f) << 8) - 1; in lzf_decompress()
365 if (len == 7) in lzf_decompress()
367 len += *ip++; in lzf_decompress()
377 ref -= *ip++; in lzf_decompress()
379 if (op + len + 2 > out_end) in lzf_decompress()
392 len += 2; in lzf_decompress()
393 lzf_movsb (op, ref, len); in lzf_decompress()
400 while (--len); in lzf_decompress()
406 return op - (u8 *)out_data; in lzf_decompress()