an input integer is limited by an array of data:
[Maski, possible-value-i], (i from 0-n)
which means the input param is a legal parameter only there is at least one i makes ,
param & Maski == possible-value-i,
Maski may equal to Maskj.
So far I have to check each Mask one by one for parameter legality.
Is there a way to compress these Mask checks to get a smaller one? (Or not the exact same check but I can use as a quick check for performance improvement).
What you have here is a circuit minimization problem. Each condition you have is of the form
These conditions are then combined with the or – operator. You can simplify your expression using the Quine-McCluskey algorithm.