[Top][All Lists]

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

RE: [lwip-users] IP Address Display Functions

From: Bill Auerbach
Subject: RE: [lwip-users] IP Address Display Functions
Date: Tue, 25 Aug 2009 14:01:07 -0400

>> Why can't we have a single "packed" attribute at the end of the struct
>>instead of using it each time at the field level?
>Different compilers have different syntaxes for declaring packing. That
>is why we have the PACK_STRUCT_STRUCT and PACK_STRUCT_FIELD macros.

Also, I see a *huge* difference in performance with packing by 2 versus 1
which we do in many if not all ports.

AFAIK (and from running for 4 months this way), packing by 2 is sufficient.
It allows a compiler to do word loads instead of 2 byte loads forming the
words when it thinks an alignment issue might exist.  I use UDP and TCP in
RAW mode so I cannot comment on whether this change would be universal or
not.  As packing is done for headers, I see no case where word alignment
isn't sufficient - our macros handle the byte field of headers explicitly.


reply via email to

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