[Ffmpeg-devel] [PATCH] avoid useless memcpy with src==dst (valgrind complains)
Måns Rullgård
mru
Sun Jul 23 12:07:42 CEST 2006
Reimar D?ffinger said:
> Hello,
> On Sun, Jul 23, 2006 at 09:50:50AM +0100, M?ns Rullg?rd wrote:
>> Reimar D?ffinger said:
>> > On Sun, Jul 09, 2006 at 12:05:16AM +0200, Reimar D?ffinger wrote:
>> >> maybe this is cosmetics (not sure of the speed effects, but I doubt the
>> >> matter here), but I prefer to have less warnings with valgrind (this is
>> >> a memcpy here since buf and last point to structs).
>>
>> Simple assignment can be faster than memcpy and is clearer.
>
> Huh? The problem is the assignment is obviously replaced by a memcpy by the
> compiler,
Depends on the struct. For small structs the compiler will generate
load/store insns directly, and it can use knowledge of alignment to optimize
things.
> which in case both point to the same place makes valgrind
> complain (since src and dst are overlapping).
If the compiler does that it's broken.
--
M?ns Rullg?rd
mru at inprovide.com
More information about the ffmpeg-devel
mailing list