lwip-users
[Top][All Lists]
Advanced

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

R: [lwip-users] struct ip_addr VS struct in_addr


From: Ceresoli Luca
Subject: R: [lwip-users] struct ip_addr VS struct in_addr
Date: Fri, 29 Aug 2008 15:53:51 +0200

Jonathan Larmour wrote:
> dst_in_addr will already be aligned, so does not need memcpy. 
> You can just do:
> dst_ip_addr.addr = dst_in_addr->addr;
> 
> However in the other direction - if there's an ip_addr you 
> need to convert back to a struct in_addr, then you /would/ 
> need memcpy, to safely guarantee alignment.

Thanks for the reply Jonathan.

It's not clear to me why one direction would need memcpy() and not the other. 
(I am speaking in general, not about the example function I provided)

Anyway, for the records, it turns out that even though my CPU (Blackfin) does 
not support unaligned access, the compiler (from Analog Devices) will translate 
those accesses into 4 byte accesses. It will be slow and pointer-unsafe, but so 
far it's ok for my --very limited-- case.

Luca





reply via email to

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