Fujitsu microcontroller used is 32bit. Hence enum storage is also 32bit. But in my project actually enum elements do not exceed more than 256. Is there any compiler options to size down the storage for enums?
This should not be in an answer. You should edit your question instead.
Joachim Sauer
2009-09-09 11:18:54
A:
You could use a bit field to be able to store 256 unique values in 8 words (256 bits / 32 bit words = 8), but then the compiler will no longer be able to enforce that only a single bit is set at a time. But, you could easily write a wrapper function to clear out all the previous bits before setting one. It would probably end up kind of messy, but that's what tends to happen when you start using these kinds of tricks at this level to save memory.
Mark Rushakoff
2009-09-09 11:07:51