[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: |
Fri, 08 Jan 2010 18:55:32 +0100 |
Alain Magloire wrote:
> Bonjour,
Bonjour Alain ! Bonne anneƩ !
It's been too long ;-)
> The behavior of memcpy is well defined:
>
> "Copying overlapping buffers isn't guaranteed to work; use memmove() to
> copy buffers that overlap"
>
> In our case for the SH architecture we have a version of memcpy that
> takes advantage at some specific instruction and above a certain size
> the copy will be done in reverse (side effect of the optimization).
>
> For overlapping copies, the code should be using memmove() as describe
> in POSIX.
...
> Index: inflate.c
...
> if (w - d >= e)
> {
> - memcpy(slide + w, slide + d, e);
> + memmove(slide + w, slide + d, e);
Can you give sample values of w, d and e for which this change
makes a difference? Doesn't the preceding (w - d >= e) guard
ensure that the source and destination buffers never overlap?
> Index: deflate.c
...
> - memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
> + memmove((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
The source and destination buffers do not overlap.
- gzip use of memcpy, Alain Magloire, 2010/01/06
- Re: gzip use of memcpy,
Jim Meyering <=
- 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, 2010/01/12