unsinged int count : 9;
unsigned int msg_id : 7;
Then later a C function that parse out msg_id from the contents of 'buffer' below
MSG_HEADER id, aa;
// get data from buffer
// later strip out the id
id = ((MSG_HEADER *)buffer)->msg_id;
aa = (((( id >> 4 ) & 0x07) <<3 )) | ( id & ox07 );
// then later
// switch (type)
// more case statements
Re-writign in C++
// inside of SomeProcessing I'll call SomeSpecialProcessing
void MY_CLASS::SomeSpecialProcessing( unsigned char * ptr)
what would be the C++ version look like for 'id' and type? Want to ensure my version is right in my code.
// id = ((MSG_HEADER *)buffer)->msg_id;
// aa = (((( id >> 4 ) & 0x07) <<3 )) | ( id & 0x07 ); // could perhaps make this more easily understood?
I'm under the impression that case statements could be viewed as poor design from a C++ context. That said, how would i get around the 'case' statements in the C code?