added unit test for masking, implemented masking
made bitfield fields variable in length