Bitwise comparation
#1

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.
Reply
#2

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

pawn Код:
(statement) == false
pawn Код:
!(statement)
Hope that helped in some way
Reply
#3

I didn't even thought of negating that complete expression. Thanks.
Reply
#4

~ = bitwise NOT
! = logical NOT

Simple as that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)