>> in calculations - 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: >> in calculations (
/showthread.php?tid=396177)
>> in calculations -
ikkentim - 29.11.2012
Hi, I'm fiddling with maths and calculations in sa-mp, I checked some posts and found people using >> and << in calculations. What does it mean? What does it do?
I did some test calculations with the following results...:
4>>0=4
4>>1=2
4>>2=1
4>>3=0
4>>4=0
4>>5=0
4>>6=0
4>>7=0
4>>8=0
4>>9=0
4>>10=0
4>>11=0
4>>12=0
4>>13=0
4>>14=0
4>>15=0
4>>16=0
4>>17=0
4>>18=0
4>>19=0
4>>20=0
4>>21=0
4>>22=0
4>>23=0
4>>24=0
4>>25=0
4>>26=0
4>>27=0
4>>28=0
4>>29=0
4>>30=0
4>>31=0
4>>32=4
4>>33=2
4>>34=1
What does it mean, and what does it do? Thanks in advance!
Re: >> in calculations -
Bicentric - 29.11.2012
It's bit shifting, for use with binary(?), there is a section on it here.
https://sampforum.blast.hk/showthread.php?tid=177523
Re: >> in calculations -
ikkentim - 29.11.2012
Awesome! Thanks!
Re: >> in calculations -
Vince - 29.11.2012
Have this table:
Power | | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Decimal | | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Binary | | 1000 0000 | 0100 0000 | 0010 0000 | 0001 0000 | 0000 1000 | 0000 0100 | 0000 0010 | 0000 0001 |
Notice a patern?