[FFmpeg-devel] [PATCH] Macros to copy small, possibly unaligned, values

Måns Rullgård mans
Wed Jun 3 00:08:03 CEST 2009


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> On Tue, Jun 02, 2009 at 03:08:13PM -0400, Jeff Downs wrote:
>> On Tue, 2 Jun 2009, Reimar D?nger wrote:
>> > Since I benchmarked that a lot on x86 back then, the obvious question
>> > is if there is any reason at all to avoid using memcpy...
>> 
>> Mans did some tests on a number of architectures and suggested it would be 
>> best to not just use memcpy universally for small, constant-sized amounts.  
>> Maybe he can post the specifics of some of his testing or summarize his
>> findings.
>
> It might be a good idea to try static inline functions instead of macros,
> since that allows you to properly use restrict on the pointers - otherwise
> memcpy will have at least a theoretical advantage.

That's an orthogonal issue, and I agree those macros would probably be
better as inline functions, especially those that evaluate their
arguments many times.  As for restrict, gcc is known to ignore it.
Not sure about other compilers.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list