Simple question about verifying values
Is the following example
Code:
if (get_pcvar_num(pcvar) == 1 || get_pcvar_num(pcvar) == 3)Code:
if (get_pcvar_num(pcvar) == (1 | 3))Thanks in advance. |
Re: Simple question about verifying values
single | is bitwise OR. Probably you can do it like that:
Code:
if (1<<get_pcvar_num(pcvar) & (1<<1)|(1<<3)) |
Re: Simple question about verifying values
Quote:
Yes that works but doesn't it multiply the value with itself? What I'm trying to do is optimize, since getting the same cvar twice in a single check is pointless. What's the best way I could do that? |
Re: Simple question about verifying values
Your 2nd example isn't right, it doesn't work that way. Unless you are dealing with bits, you will need to do as you did in your 1st example
|
Re: Simple question about verifying values
Quote:
Thank you. |
| All times are GMT -4. The time now is 05:59. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.