[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] Packed structures
From: |
Florian Schulze |
Subject: |
[lwip-users] Re: [lwip] Packed structures |
Date: |
Wed, 08 Jan 2003 22:16:57 -0000 |
> I guess this depends on the compiler, but in my experience it is only the
> arp_hdr that needs to be packet. The other headers are aligned in such a way
> that 16-bit word accesses are on a 16-bit word boundary, 32-bit accesses are
> on a 32-bit boundary, etc. I guess the protocol designers had this in mind
> when they designed the header layouts.
I will try that out, I hope it will not be aligned on 32bit boundaries.
> When it comes to the best way to pack the structure, I would think that
> something along the lines of a PACK_STRUCT macro and a PACK_STRUCT_FIELD
> macro would be the way to go. The actual #definition of the macro could be
> put in the arch/cc.h file and the structs that needs packing could be defined
> as:
>
> PACK_STRUCT(
> struct a_struct_that_needs_to_be_packed {
> PACK_STRUCT_FIELD(u8_t a);
> PACK_STRUCT_FIELD(u32_t b);
> }
> )
>
> But it would looks rather cluttred...
But it would only be for very few headers. The only problem I see with this is
that some compilers don't like #'s in #defines.
Florian
[This message was sent through the lwip discussion list.]
- [lwip-users] Re: [lwip] Packed structures,
Florian Schulze <=
- [lwip-users] Re: [lwip] Packed structures, Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] Packed structures, Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] Packed structures, Adam Dunkels, 2003/01/09
- [lwip-users] Re: [lwip] Packed structures, Adam Dunkels, 2003/01/09
- [lwip-users] Re: [lwip] Packed structures, Florian Schulze, 2003/01/09
- [lwip-users] Re: [lwip] Packed structures, Florian Schulze, 2003/01/09