[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE : [lwip-devel] SMEMCPY
From: |
Frédéric BERNON |
Subject: |
RE : [lwip-devel] SMEMCPY |
Date: |
Fri, 25 Jan 2008 14:54:31 +0100 |
There is some "memcpy" in the code, shouldn't we replace them by MEMCPY ?
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : address@hidden
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Goldschmidt Simon
Envoyé : mardi 22 janvier 2008 13:36
À : lwip-devel
Objet : RE: [lwip-devel] SMEMCPY
> SMEMCPY description is :
>
> "SMEMCPY: override this with care! Some compilers (e.g. gcc) can
inline a
> * call to memcpy() if the length is known at compile time and is
small."
>
> But I see some use in sockets.c like SMEMCPY(addr, &sin, *addrlen); In
this case, the size is not known at compile > time. What is the correct use (or
description) for this macro ?
Those macros are defined because memcpy can be sped up on many platforms (using
loop unrolling / large register file etc.). But most of the time, this involves
a lengthy initialization (finding out whether src and dst are aligned etc.).
So while in this situation, the compiler can't inline the memcpy, we still know
*addrlen is so small that it perhaps isn't worth the lengthy initialization of
the overridden MEMCPY and thus use the (perhaps) smaller implementation of
memcpy() (which SMEMCPY points to).
Simon
_______________________________________________
lwip-devel mailing list
address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-devel
Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE : [lwip-devel] SMEMCPY,
Frédéric BERNON <=