Bitwise comparation - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Bitwise comparation (
/showthread.php?tid=105912)
Bitwise comparation -
niCe - 31.10.2009
Please, how to negate this expression - keys & KEY_FIRE. I tried keys ~ KEY_FIRE but this is incorrect syntax for pawno. Thanks in advance for your help.
Re: Bitwise comparation -
Nero_3D - 31.10.2009
Valid bitwise character in pawn (you can add your own if you want)
Quote:
Originally Posted by pawn-lang.pdf
~e - results in the one's complement of e.
e1 >> e2 - results in the arithmetic shift to the right of e1 by e2 bits. The shift operation is signed: the leftmost bit of e1 is copied to vacant bits in the result.
e1 >>> e2 - results in the logical shift to the right of e1 by e2 bits. The shift operation is unsigned: the vacant bits of the result are filled with zeros.
e1 << e2 - results in the value of e1 shifted to the left by e2 bits; the rightmost bits are set to zero. There is no distinction between an arithmetic and a logical left shift
e1 & e2 - results in the bitwise logical "and" of e1 and e2.
e1 | e2 - results in the bitwise logical "or" of e1 and e2.
e1 ^ e2 - results in the bitwise "exclusive or" of e1 and e2.
|
and how to negate some statement
Hope that helped in some way
Re: Bitwise comparation -
niCe - 31.10.2009
I didn't even thought of negating that complete expression. Thanks.
Re: Bitwise comparation -
Google63 - 31.10.2009
~ = bitwise NOT
! = logical NOT
Simple as that