summaryrefslogtreecommitdiff
path: root/lzf_d.c
diff options
context:
space:
mode:
authorroot <root>2007-06-21 22:11:34 +0000
committerroot <root>2007-06-21 22:11:34 +0000
commit3abfcd994a7dad841f223bb64bd74fb59d13fef2 (patch)
tree1f0da4493c9d60ef30858bac6491556a00e71783 /lzf_d.c
parent4e5f1e7cb11f71bcc35be6babc6a3ba037e5b5b8 (diff)
*** empty log message ***
Diffstat (limited to 'lzf_d.c')
-rw-r--r--lzf_d.c18
1 files changed, 14 insertions, 4 deletions
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);