|There's more than one way to do things|
Re: Conditional Eliminationby pileofrogs (Priest)
|on Aug 30, 2011 at 23:35 UTC||Need Help??|
Like everyone has said, it depends heavily on your particular situation. I'm going to mention an approach that you almost certainly should NOT use. If clarity is important, DO NOT DO THIS. But it's fun, so I'm going to try to write about it.
You can pack the variables into fewer variables.
Lets say you have two variables A and B. Each can have a value from 0 - 99. Then we could multiply Ax100 and add it to B. Then we have 1 variable instead of two but it contains all the information of the 2 original variables and you can check it easily in one operation.
To continue the example, Lets say if A=34 and B=75 the world explodes. All we have to do is our little operation and then see if it equals 3475.
This is the same thing you see with bit maps for things like file permission modes.
Again, this is NOT AT ALL recommended for clarity. It's just another way of thinking of a problem like this.
It's also probably not faster than a whole buncha == && == &&. I think it would depend on how many variables, how many iterations it goes through etc...