Input stream read_bitmask method refactored.