Improve lzjb decompress performance by reorganizing the code

to tighten the copy loop.

Submitted by:	Denis Ahrens <denis h3q com>
MFC after:	2 weeks
Approved by:	re (gjb)
This commit is contained in:
Xin LI 2013-10-08 01:38:24 +00:00
parent 64db896617
commit 6eb151f212
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256132

View File

@ -117,7 +117,9 @@ lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
src += 2;
if ((cpy = dst - offset) < (uchar_t *)d_start)
return (-1);
while (--mlen >= 0 && dst < d_end)
if (mlen > (d_end - dst))
mlen = d_end - dst;
while (--mlen >= 0)
*dst++ = *cpy++;
} else {
*dst++ = *src++;