Skip to content

Instantly share code, notes, and snippets.

@hsnks100
Created September 4, 2018 06:39
Show Gist options
  • Save hsnks100/06c447c8e245f3dc879ed5b391c5e487 to your computer and use it in GitHub Desktop.
Save hsnks100/06c447c8e245f3dc879ed5b391c5e487 to your computer and use it in GitHub Desktop.
struct header1 {
uint16_t a1;
int16_t a2;
int16_t a3;
int16_t a4;
int16_t a5;
int16_t a6;
int16_t a7;
int16_t a8;
int16_t a9;
};
struct header2 {
uint32_t length : 24;
int16_t a2;
int16_t a3;
int16_t a4;
int16_t a5;
int16_t a6;
int16_t a7;
int16_t a8;
int16_t a9;
};
union protocol {
header1 protocol1;
header2 protocol2;
} p;
if(해더에 따라...) {
p.protocol1 = (temp*)&read_msg_[0];
}
else if(해더에 따라...) {
p.protocol2 = (length3*)&read_msg_[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment