lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] byte order, packing, optimizations


From: Simon Goldschmidt
Subject: Re: [lwip-devel] byte order, packing, optimizations
Date: Mon, 08 Feb 2010 12:55:19 +0100

"Stéphane Lesage" wrote:
> Any port which cannot do misaligned access will set MEM_ALIGN to 2 or 4. 

Well, that's correct... I'll think about a macro for it. In any case if using 
this there should be a check in debug builds to ensure correct alignment, I 
guess.

>  >>BTW, ip_addr_set should be use only for safe copy, the latest
>  >> modifications use it everywhere, even if we don't have to check
>  >> the pointer.
>  >I might have to check that again, but I think the only places where I 
> used that unchecked is the SNMP code.
>  >If there are other places where it is used unchecked, please tell me.
> 
> In most of the following places, the pointer is a field of a structure, 
> so it will never be null:

Oh, now I get it, you want to remove the check for the pointer to be non-NULL! 
I thought you wanted to check for alignment...

Removing the non-NULL check on non-pointers if of course a good idea. However, 
I would have thought a good compiler would optimize the NULL-check away... 
Anyway, thanks for the list, I'll check that.

> should be changed to:
> #define ip_addr_set_any(ipaddr) (ipaddr)->addr = IPADDR_ANY

And that, too.

Simon
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser




reply via email to

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