Add bitfield definition

This PR adds the Bitfield type which allows definition and packing/unpacking of bitfields.

The bitfield packing is a bit of a hack right now and definitely can be cleaned up. Also will consider abstracting out the casting/conversion of the raw integer to bool etc to another method.