bit shifting, becomes zero when it shouldn't.... bug? - 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)
+--- Thread: bit shifting, becomes zero when it shouldn't.... bug? (
/showthread.php?tid=619077)
bit shifting, becomes zero when it shouldn't.... bug? -
Yashas - 13.10.2016
Код:
printf("%d", 95<<24 + 102<<16 + 109<<8 + 100);
prints zero for some reason when it isn't zero
Why?
Re: bit shifting, becomes zero when it shouldn't.... bug? -
Konstantinos - 13.10.2016
I assume it does left shifting the result of the addition. Using parentheses fixes it:
pawn Код:
(95<<24) + (102<<16) + (109<<8) + 100
Re: bit shifting, becomes zero when it shouldn't.... bug? -
Dayrion - 13.10.2016
What "<<" mean ?