I have a variable that consists of several flags ORed together, and I'd like to test which combination of them my value is and act on that. Unfortunately, the | operator has a different meaning in a match statement, so I can't write
match x {
(FLAG1 | FLAG2) => return 5;
(FLAG1 | FLAG3) => return 6;
(FLAG2 | FLAG3) => return y;
_ => return 0;
}
and instead I need to precompute (FLAG1 | FLAG2) and so on, making my code ugly and unreadable. Is there a better way to do this?