bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gzip use of memcpy


From: Jim Meyering
Subject: Re: gzip use of memcpy
Date: Tue, 12 Jan 2010 08:53:14 +0100

Yuxi Zhang wrote:
> It would be nice to declare the delta inside the function scope.

Why?
I find it less readable and less maintainable.
Do you have to use a compiler for which that is required?
If so, please give its name and version number.

> Index: inflate.c
> ===================================================================
> --- inflate.c (revision 248271)
> +++ inflate.c (working copy)
> @@ -526,6 +526,7 @@
>    register unsigned e;  /* table entry flag/number of extra bits */
>    unsigned n, d;        /* length and index for copy */
>    unsigned w;           /* current window position */
> +  unsigned delta;       /* delta between slide+w and slide+d */
>    struct huft *t;       /* pointer to table entry */
>    unsigned ml, md;      /* masks for bl and bd bits */
>    register ulg b;       /* bit buffer */
> @@ -593,7 +594,9 @@
>        do {
>          n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n :
> e);
>  #if !defined(NOMEMCPY) && !defined(DEBUG)
> -        if (w - d >= e)         /* (this test assumes unsigned
> comparison) */
> +        /* make the unsigned comparision in positive range. */
> +        delta = w > d ? w - d : d - w;
> +        if (delta >= e)         /* (this test assumes unsigned
> comparison) */

I know it is line with the style of the existing code,
but that code certainly does not qualify as a role model.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]