bitmask operations

working with bitmasks (with multiple states allowed)