Skip to content

Commit

Permalink
Do not initialise LZS hash_chain array
Browse files Browse the repository at this point in the history
There's no point; we will only ever read from the locations we've written
to. This saves about 4%.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 8, 2015
1 parent 1cbf40a commit f513a70
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lzs.c
Expand Up @@ -208,10 +208,9 @@ int lzs_compress(unsigned char *dst, int dstlen, const unsigned char *src, int s
if (srclen > INVALID_OFS + 1)
return -EFBIG;

/* There are ways we could probably avoid having to do this memset
* each time... */
/* No need to initialise hash_chain since we can only ever follow
* links to it that have already been initialised. */
memset(hash_table, 0xff, sizeof(hash_table));
memset(hash_chain, 0xff, sizeof(hash_chain));

while (inpos < srclen - 1) {
hash = HASH(src + inpos);
Expand Down

0 comments on commit f513a70

Please sign in to comment.