Nicolas Martin <nicolas0martin at gmail.com> wrote: Hi,
> What is weird here, is that the effect of overlap in memcpy does not > seem to produce the same effect on different systems ! Using memcpy() on overlapping memory areas is undefined behaviour per spec. glibc has several memcpy() implementations optimized for different hardware capabilities. A recent implementation for Atom/Core2 CPUs performs the copy from tail to head (giving a nice 4x/5x speedup on these CPUs), which breaks with overlapping memory areas. Using memmove() is the correct way to handle overlapping areas, as documented. See <http://lwn.net/Articles/414467/> for more (links/comments). HTH, JB. -- Julien BLACHE <http://www.jblache.org> <jb at jblache.org> GPG KeyID 0xF5D65169
