Сообщение Re: Смещение и sizeof битового поля от 22.09.2016 8:47
Изменено 22.09.2016 8:48 _Butch_
[code]
typedef struct s_tagDsDataPacket
{
unsigned char Code;
unsigned short SiteID;
DS_TIME Time;
unsigned short CraneNo;
short Load;
unsigned short Capacity;
short HookRadius;
unsigned short LuffAngle;
short HookHeight;
unsigned short SlewAngle;
union
{
struct
{
unsigned short WindSpeed : 10;
unsigned short WindDir : 6;
} Wind;
unsigned short dummy;
} u;
unsigned long IP;
unsigned short Fault;
unsigned char ACD;
unsigned short NB;
unsigned long AC;
unsigned long ERR;
unsigned short CRC;
}DS_DATAPACKET, *PDS_DATAPACKET;
typedef struct s_tagDsDataPacket
{
unsigned char Code;
unsigned short SiteID;
DS_TIME Time;
unsigned short CraneNo;
short Load;
unsigned short Capacity;
short HookRadius;
unsigned short LuffAngle;
short HookHeight;
unsigned short SlewAngle;
union
{
struct
{
unsigned short WindSpeed : 10;
unsigned short WindDir : 6;
} Wind;
unsigned short dummy;
} u;
unsigned long IP;
unsigned short Fault;
unsigned char ACD;
unsigned short NB;
unsigned long AC;
unsigned long ERR;
unsigned short CRC;
}DS_DATAPACKET, *PDS_DATAPACKET;
Re: Смещение и sizeof битового поля
typedef struct s_tagDsDataPacket
{
unsigned char Code;
unsigned short SiteID;
DS_TIME Time;
unsigned short CraneNo;
short Load;
unsigned short Capacity;
short HookRadius;
unsigned short LuffAngle;
short HookHeight;
unsigned short SlewAngle;
union
{
struct
{
unsigned short WindSpeed : 10;
unsigned short WindDir : 6;
} Wind;
unsigned short dummy;
} u;
unsigned long IP;
unsigned short Fault;
unsigned char ACD;
unsigned short NB;
unsigned long AC;
unsigned long ERR;
unsigned short CRC;
}DS_DATAPACKET, *PDS_DATAPACKET;