bug-gzip
[Top][All Lists]
Advanced

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

RE: gzip use of memcpy


From: Yuxi Zhang
Subject: RE: gzip use of memcpy
Date: Tue, 12 Jan 2010 09:12:05 -0500

> Why?
I just guess that would have some benefit for performance since we do
not need to declare the variable each time to enter the loop(it is a
just pure guess). That is my condiseration to put the declaration inside
the loop.  

> I find it less readable and less maintainable.
Agree.

> Do you have to use a compiler for which that is required?
> If so, please give its name and version number.
No.

Thanks
Yuxi


> 
> > 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]