Draft work making the bitfield functions more generic.