Using mask and shift instead of bitfields