Force bitwise operation to return only 0 or 1
#1

Hi there. I'm debugging some stuff, and I'm using bitflags to speed up the process. Take a look:

pawn Код:
new test = 8, Float:b = 79.5;
new a = (test & 8);
Well, nope, this returns me 8. Now I've tried
pawn Код:
new a = _:(test & 8 > 0);
Cool, it works, but I don't want to rewrite it each time I use a flag.
pawn Код:
new a = (test & 8 % 2);
Is there some magic bitoperator which will return me 1 if flag is present and 0 if not? (I'm not talking about bool, but integer/tagless number)

#e: nope, the second method isn't even supposed to work
Reply


Messages In This Thread
Force bitwise operation to return only 0 or 1 - by Misiur - 19.03.2013, 13:51
Re: Force bitwise operation to return only 0 or 1 - by Vince - 19.03.2013, 13:58
Re: Force bitwise operation to return only 0 or 1 - by Misiur - 19.03.2013, 14:00

Forum Jump:


Users browsing this thread: 1 Guest(s)