[Top][All Lists]
[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.
- gzip use of memcpy, Alain Magloire, 2010/01/06
- Re: gzip use of memcpy, Jim Meyering, 2010/01/08
- RE: gzip use of memcpy, Alain Magloire, 2010/01/08
- RE: gzip use of memcpy, Alain Magloire, 2010/01/08
- Re: gzip use of memcpy, Jim Meyering, 2010/01/10
- RE: gzip use of memcpy, Alain Magloire, 2010/01/11
- Re: gzip use of memcpy, Jim Meyering, 2010/01/11
- RE: gzip use of memcpy, Yuxi Zhang, 2010/01/11
- Re: gzip use of memcpy,
Jim Meyering <=
- RE: gzip use of memcpy, Yuxi Zhang, 2010/01/12
- RE: gzip use of memcpy, Alain Magloire, 2010/01/12