Is there better way than declare enumeration as
public enum DepthNumberSize { Bit1 = 1, Bit4 = 4, Bit8 = 8, Bit16 = 16, Bit32 = 32 }
and every time when operations with related data chunk performed switch statements are used, like:
switch(size) { case DepthNumberSize.Bit1: buffer[i++] = input[j] & 1; buffer[i++] = (input[j] >> 1) & 1; // cut case DepthNumberSize.Bit8: buffer[i++] = input[j++]; break; case DepthNumberSize.Bit16: buffer[i++] = input[j] | (input[j] << 8); j += 2; break; // cut }
?
Thanks.
You could do something like this:
Then you can call it like this:
This way you can remove the switch.