From 3abfcd994a7dad841f223bb64bd74fb59d13fef2 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 21 Jun 2007 22:11:34 +0000 Subject: *** empty log message *** --- lzf_d.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lzf_d.c') diff --git a/lzf_d.c b/lzf_d.c index 73a1a80..61df183 100644 --- a/lzf_d.c +++ b/lzf_d.c @@ -45,6 +45,13 @@ # define SET_ERRNO(n) errno = (n) #endif +#if (__i386 || __amd64) && __GNUC__ >= 3 +# define lzf_movsb(dst, src, len) \ + asm ("rep movsb" \ + : "=D" (dst), "=S" (src), "=c" (len) \ + : "0" (dst), "1" (src), "2" (len)); +#endif + unsigned int lzf_decompress (const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len) @@ -76,10 +83,8 @@ lzf_decompress (const void *const in_data, unsigned int in_len, } #endif -#if USE_MEMCPY - memcpy (op, ip, ctrl); - op += ctrl; - ip += ctrl; +#ifdef lzf_movsb + lzf_movsb (op, ip, ctrl); #else do *op++ = *ip++; @@ -125,12 +130,17 @@ lzf_decompress (const void *const in_data, unsigned int in_len, return 0; } +#ifdef lzf_movsb + len += 2; + lzf_movsb (op, ref, len); +#else *op++ = *ref++; *op++ = *ref++; do *op++ = *ref++; while (--len); +#endif } } while (ip < in_end); -- cgit v1.2.3