Operator '^' ( power ) - 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: Operator '^' ( power ) (
/showthread.php?tid=103917)
Operator '^' ( power ) -
UsaBoy91 - 21.10.2009
Why this operator make addition ?
Re: Operator '^' ( power ) -
UsaBoy91 - 21.10.2009
e.g.:
pawn Код:
print("%d",2^4); // will result 6
Re: Operator '^' ( power ) -
Correlli - 21.10.2009
Quote:
Originally Posted by Angel φ
e.g.:
pawn Код:
print("%d",2^4); // will result 6
|
That won't result anything (it will display bad parameter count - 2, should be 1) because you're using normal print function which can't format placeholders like %d. Use printf function.
Re: Operator '^' ( power ) -
yom - 21.10.2009
RTFM, ^ isn't the power operator.
Re: Operator '^' ( power ) -
UsaBoy91 - 21.10.2009
ok Orb, but i don't get any error and in c# / c++ operator ^ means operator power ...
Re: Operator '^' ( power ) -
yom - 21.10.2009
In Pawn unfortunately it isn't, but there is floatpower().
Re: Operator '^' ( power ) -
UsaBoy91 - 21.10.2009
yes , i know this , but what about ******'s Encrypt System ? Why he used that operator ?
pawn Код:
public Encrypt(string[])
{
for(new x=0; x < strlen(string); x++)
{
string[x] += (3^x) * (x % 15);
if(string[x] > (0xff)) // 255
{
string[x] -= 256;
}
}
return 1;
}
Re: Operator '^' ( power ) -
yom - 21.10.2009
I don't think ****** wrote this shit.
^ IS an operator in Pawn, but not the power operator:
Quote:
e1 ^ e2 results in the bitwise “exclusive or” of e1 and e2.
|
Re: Operator '^' ( power ) -
Google63 - 21.10.2009
XOR operator for short.
Bitwise operators:
XOR = ^
AND = &
OR = |
NOT = ~