[Top][All Lists]

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

Re: [lwip-devel] [PATCH] Fix aliasing violation.

From: address@hidden
Subject: Re: [lwip-devel] [PATCH] Fix aliasing violation.
Date: Fri, 03 Oct 2008 16:43:13 +0200
User-agent: Thunderbird (Macintosh/20080914)

David Woodhouse wrote:
But we should use SMEMCPY.  I use a macro that converts this to a
series of inline load/stores.
Isn't that the compiler's job?

In 1.3.0, we converted all calls to 'memcpy' to either 'MEMCPY' or 'SMEMCPY' (s for short). The goal is optimization: SMEMCPY is defined to memcpy (which the compiler may inline e.g. if size is known at compile time and small); whil MEMCPY can be overridden to provide a better copy mechanism (on my platform, for example, copying non-aligned data can be solved much better when loading full words and shifting in registers).

Therfore, using 'memcpy' directly should be avoided: when you know your compiler can't optimize it, you can redefine SMEMCPY to inlining yourself.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]