[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: gzip use of memcpy
From: |
Alain Magloire |
Subject: |
RE: gzip use of memcpy |
Date: |
Tue, 12 Jan 2010 23:36:35 -0500 |
> From: Jim Meyering [mailto:address@hidden
> Sent: Tuesday, January 12, 2010 2:53 AM
> To: Yuxi Zhang
> Cc: Alain Magloire; address@hidden
> Subject: Re: gzip use of memcpy
>
Bonjour,
> 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.
>
Ouch! You are a hard man to please 8-).
We were using the watcom cc, but we stop its use, now out of (bad)
habit, the testers/developers still do the declaration at the beginning
of the block. But you are right it should not be a problem.
You're patch was tested on a SH4a and it seems to be fine.
> > 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, 2010/01/12
- RE: gzip use of memcpy, Yuxi Zhang, 2010/01/12
- RE: gzip use of memcpy,
Alain Magloire <=