Generalize bitfield code to work with 32/64-bit integer types

Just in case