lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Struct packing/alignment problems


From: Atte Kojo
Subject: Re: [lwip-users] Struct packing/alignment problems
Date: Tue, 27 Apr 2004 09:39:45 +0300

On Mon, 2004-04-26 at 20:05, Timmy Brolin wrote:

> (lwip does not work on systems without support for 8bit types anyway).

That is not correct. I have lwip running fine on a Motorola DSP that
supports only 24- and 48-bit data types. The packet handling code needed
to be modified, though.

Only way to get alignments right is to use u8_t (u8_t is actually 24
bits) arrays in all structs that handle packets and use macros to
pack/unpack the values. Consumes memory but is quite fast and has also
the advantage that ntoh/hton-functions are unnecessary.

i.e. u32t_addr => u8_t addr[4]

Other solution would be to pack all data (shifting and masking and
calculating a lot) into 24-bit fields but that would take way too much
time.

        - Atte Kojo

-- 
"Hardware simply does not work like the manual says and no amount of Zen
contemplation will ever make you at one with a 3c905B ethernet card." 

- Alan Cox





reply via email to

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