lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] SMEMCPY()


From: address@hidden
Subject: Re: [lwip-devel] SMEMCPY()
Date: Mon, 13 Jun 2011 11:37:44 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

Am 12.06.11 20:20, schrieb Kieran Mansley:
Anyway, this change has been mimal-invasive by defining both MEMCPY() and 
SMEMCPY() to memcpy(), so I cannot see the downside of it.
The downside would be that if we previously had an efficient byte copy inlined 
in the code, and  that was replaced with a call to SMEMCPY() which maps to 
memcpy(), then we could have harmed performance.
Oh, OK, now I get it. Sorry for taking so long :-)

I see your point there. In that case, letting SMEMCPY() default to a byte copy define might be the best idea? Something like:

#define SMEMCPY(dst, src, len) do { size_t i; for(i = 0; i < len; i++) { ((u8_t*)dst)[i] = ((u8_t*)src)[i]; } }while(0)

should do it, then.
Of course, it's always size vs. speed, I guess. On some platforms, calling memcpy is smaller than a local byte-copy loop, on other platforms it may be the other way round. However, I think the define-version is better than defaulting to memcpy here.

Simon



reply via email to

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