So I need to read flags in bits and set flags in bits. These bits are in various sizes of integer: int16, int32, int64, etc.
I would like to have a function that does something like this:
static integertype function(integertype data, char startbit, char endbit);
I don't want to code what will be the same code to isolate bits from for different sizes of integers in separate but identical functions (for the multitude of bit functions I want to write).
I thought about using a void pointer for the data so everything could run through one function. Is this a bad design? What about as far as efficiency goes? I have no concept of bad/good design due to my inexperience.
static int function(void *data, char startbit, char endbit)
These flags have to be looked at very often as this is for a data acquisition system. Would a void pointer implementation be reasonably efficient?
I know premature optimization is bad, but I would like to know what things are generally less or more efficient than others so I can make good decisions.
Thanks in advance for taking me to school.