I have four integers {a, b, c, d} that can have the following range of values:
a
b
c
d
a - {0 or 1} (1 bi
Pretty simple. Mask (for range), shift them into place, and or them together.
packed = ((a & 1) << 7) | ((b & 1) << 6) | ((c & 7) << 3) | (d & 7) a = (packed >> 7) & 1 b = (packed >> 6) & 1 c = (packed >> 3) & 7 d = packed & 7