rect
Member
|
how to use #pragma pack( push, 1) at EE editor
Hi every one.
I write a struct like that
Code:
#pragma pack( push, 1)
struct SPackage
{
U16 u16Test; // 2 bit
U8 u8Test; // 1 bit
U32 u32Test1; // 4 bit
U32 u32Test2; // 4 bit
U64 u64Test; // 8 bit
U32 u32Test3; // 4 bit
SPackage()
{
ZeroN(&T, 1);
}
}
#pragma pack(pop)
at other editor.
sizeof(SPackage) must be (2 + 1 + 4 + 4 + 8 + 4) = 23 bit
but at EE editor sizeof(SPackage) is 40.
my question is:
1.Why?
2.how to use #pragma pack at EE Editor?
(This post was last modified: 05-26-2015 10:22 AM by rect.)
|
|
05-26-2015 10:21 AM |
|
Pixel Perfect
Member
|
RE: how to use #pragma pack( push, 1) at EE editor
|
|
05-26-2015 12:22 PM |
|
Zervox
Member
|
RE: how to use #pragma pack( push, 1) at EE editor
Also correction, it is bytes not bits.
|
|
05-27-2015 02:28 AM |
|
rect
Member
|
RE: how to use #pragma pack( push, 1) at EE editor
thanks,i can use now,just written like that:
struct SPackage
{
#pragma pack( push, 1)
U16 u16Test; // 2 bit
U8 u8Test; // 1 bit
U32 u32Test1; // 4 bit
U32 u32Test2; // 4 bit
U64 u64Test; // 8 bit
U32 u32Test3; // 4 bit
#pragma pack(pop)
SPackage()
{
ZeroN(&T, 1);
}
}
|
|
05-28-2015 03:14 AM |
|