Bitfield fixes

The BitField class added in b4337a2192 turned out to have some critical issues: Generated assembly code would be bloated and slow, and also the code had alignment issues when compiling on ARM. This branch contains two tiny patches which fix those issues by inlining all class methods and by ensuring proper structure packing. An additional third patch adds unit tests for the alignment fixes.