N
nass
hello everyone,
i read somewhere that it is possible to define a BitFields structure
so i set out to:
then
FileTime is just a typedef for an unsigned long.
dump fields are NOT used.
so basically i wanted to pack 3, 10-bit numbers in IC_X (and leave the
2 MSB bits unused), then another 3 10-bit nums in EVS, then 7 bools in
SE_P, and another 3 bools in ALS.
finally pack them all together (along with an unsigned long
timeStamp) to a 14byte long structure.
with this structure though i get a sizeof(LogEntry)=20 in execution...
what am i missing?
thank you for your help
nass
i read somewhere that it is possible to define a BitFields structure
so i set out to:
Code:
struct IC_X
{
unsigned short int dump:2;
unsigned short int ic1:10;
unsigned short int ic2:10;
unsigned short int ic3:10;
};
struct EVS
{
unsigned short int dump:2;
unsigned short int v:10;
unsigned short int p:10;
unsigned short int q:10;
};
struct SE_P
{
unsigned short int dump:1;
unsigned short int c1s:1;
unsigned short int c2s:1;
unsigned short int c3s:1;
unsigned short int c1e:1;
unsigned short int c2e:1;
unsigned short int c3e:1;
unsigned short int rC:1;
};
struct ALS
{
unsigned short int dump:5;
unsigned short int al1:1;
unsigned short int al3:1;
unsigned short int al4:1;
};
Code:
struct LogEntry
{
IC_X icx;
EVS evs;
SE_P sep;
ALS als;
FileTime TimeStamp;
};
FileTime is just a typedef for an unsigned long.
dump fields are NOT used.
so basically i wanted to pack 3, 10-bit numbers in IC_X (and leave the
2 MSB bits unused), then another 3 10-bit nums in EVS, then 7 bools in
SE_P, and another 3 bools in ALS.
finally pack them all together (along with an unsigned long
timeStamp) to a 14byte long structure.
with this structure though i get a sizeof(LogEntry)=20 in execution...
what am i missing?
thank you for your help
nass