diff options
author | Marc Lehmann <schmorpforge@schmorp.de> | 2015-02-24 02:46:10 +0300 |
---|---|---|
committer | Marc Lehmann <schmorpforge@schmorp.de> | 2015-02-24 02:46:10 +0300 |
commit | 7eba614039082b930d282684355a53bf25733df6 (patch) | |
tree | 7fec010340e569a8bf90ab5e1ba16542912e01be | |
parent | d71a793968b0dcaaa71eeae25165685aa98f522a (diff) |
*** empty log message ***
-rw-r--r-- | lzfP.h | 13 | ||||
-rw-r--r-- | lzf_d.c | 13 |
2 files changed, 24 insertions, 2 deletions
@@ -146,6 +146,19 @@ */ /*#define LZF_USE_OFFSETS autodetect */ +/* + * Whether to optimise code for size, at the expense of speed. Use + * this when you are extremely tight on memory, perhaps in combination + * with AVOID_ERRNO 1 and CHECK_INPUT 0. + */ +#ifndef OPTIMISE_SIZE +# ifdef __OPTIMIZE_SIZE__ +# define OPTIMISE_SIZE 1 +# else +# define OPTIMISE_SIZE 0 +# endif +#endif + /*****************************************************************************/ /* nothing should be changed below */ @@ -52,7 +52,7 @@ #endif #endif -unsigned int +unsigned int lzf_decompress (const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len) { @@ -85,6 +85,9 @@ lzf_decompress (const void *const in_data, unsigned int in_len, #ifdef lzf_movsb lzf_movsb (op, ip, ctrl); +#elif OPTIMISE_SIZE + while (ctrl--) + *op++ = *ip++; #else switch (ctrl) { @@ -141,6 +144,12 @@ lzf_decompress (const void *const in_data, unsigned int in_len, #ifdef lzf_movsb len += 2; lzf_movsb (op, ref, len); +#elif OPTIMISE_SIZE + len += 2; + + do + *op++ = *ref++; + while (--len); #else switch (len) { @@ -155,7 +164,7 @@ lzf_decompress (const void *const in_data, unsigned int in_len, } else { - /* overlapping, use octte by octte copying */ + /* overlapping, use octet by octet copying */ do *op++ = *ref++; while (--len); |