Mask the flags that are OR:ed, and split the expression in two.