lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t)


From: Bill Auerbach
Subject: [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t)
Date: Mon, 01 Feb 2010 20:20:00 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)

Follow-up Comment #22, bug #27352 (project lwip):

Wasn't the point memory alignment requirements?  The original post was about
packing the ip-addr struct because there was significant overhead to have
every ip_addr access be byte-wide with ANDs, ORs and shifts.  Not packing
means you can't take the address of a casted ip_hdr pointer into payload in
any callbacks, and your point on this was well advised.  So I'm saying, don't
pass the address of an ip_addr anywhere but simply pass in a typedef ip_addr
into all functions.  If this typedef of ip_addr becomes a struct for IPv6,
fine, it will be copied by the compiler avoiding alignment problems then as
well. For IPv4, just using a typedef yo u32_t passes by value which is more
efficient.

This means that ip_addr becomes a typedef and for IPv4 it's u32_t and for
IPv6 it's some structure.  The point being is that the C code is compatible
with either typedef.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?27352>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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