|
From: | address@hidden |
Subject: | Re: [lwip-devel] memory alignment in 32bit architecture |
Date: | Fri, 20 Mar 2009 19:00:37 +0100 |
User-agent: | Thunderbird 2.0.0.19 (Macintosh/20081209) |
Piero 74 wrote:
in my lwip porting, on arm7 architecture (so, 32bit architecture), i have these defines in cc.h (the compiler is IAR):The defines are correct. The arm platform (as most 32-bit platforms) has a default alignment of 32 bit (i.e. 4). The defines are used to switch to byte-alignment for some structs, mostly network headers where there is no alignment offset allowed. This is a commonly used thing with network protocols and known in C as "packed structs".#define PACK_STRUCT_BEGIN _Pragma("pack(1)") #define PACK_STRUCT_STRUCT #define PACK_STRUCT_END _Pragma("pack()") #define PACK_STRUCT_FIELD(x) x are they right?i'm thinking if it could be correct in 32bit architecture use _Pragma("pack(4)")
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |