I'm making some code for a 16 bits microprocessor. My memory is quite limited at 128 KB. IAR C/C++ Compiler for MSP430 I need to implement some code to save some memory.
I tried to implemented this with this C characteristic implementation.
struct {
unsigned int widthValidated : 1;
unsigned int heightValidated : 1;
} status;
But with this bit of code I still only use 1 bit of a 16 bit word.
My goal is to use the same word sized bit of memory for two 8 bit variables. The first variable should be 8 bits left of the second variable.
struct {
unsigned int widthValidated : 8; //8 bits for this
unsigned int heightValidated : 8; // 8 left over for this
} status;
Is this possible? Are there any implementations of this or is there a library in C for this? How should I go about doing this?