Merge "Fix bitmask arithmetic to match up with decoding."