gzip -d: use memcpy more often
authorYuxi Zhang <YZhang@qnx.com>
Mon, 11 Jan 2010 17:28:30 +0000 (18:28 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 11 Jan 2010 17:30:47 +0000 (18:30 +0100)
* inflate.c (inflate_codes): Use memcpy (rather than slower
memcopy-like code) in more cases.

inflate.c

index 5b6831434d7ecc1854365c6324322c635e9a7c5b..75353e2d72b50f0fb48d51a5ef6498d324dbf901 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -589,7 +589,8 @@ int bl, bd;             /* number of bits decoded by tl[] and td[] */
       do {
         n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
 #if !defined(NOMEMCPY) && !defined(DEBUG)
-        if (d < w && w - d >= e)
+        unsigned int delta = w > d ? w - d : d - w;
+        if (delta >= e)
         {
           memcpy(slide + w, slide + d, e);
           w += e;