If you shift a number with $number<<20, it's multiplied by 1024*1024. That's useful to convert MB into Bytes:
Code:megabytes = 256;
bytes = megabytes << 20;
Printable View
If you shift a number with $number<<20, it's multiplied by 1024*1024. That's useful to convert MB into Bytes:
Code:megabytes = 256;
bytes = megabytes << 20;
Your explanation is kinda bad.
Are you just trying to say that the operator << 20 will multiply by 1024?
Bytes into Kilobytes:
256 << 10 == 256 * 1024
Bytes into Megabytes:
256 << 20 == 256 * 1024 * 1024
One shift to left is "multiplied by 2", so 10 shifts are 2^10 = 1024, which is the "byte to kilobyte" formula... no clue if that's understandable now xD
Just gonna clear up Kung's failure:
1 << 1 returns 2
1 << 2 returns 4
1 << 3 returns 8
As you can see the number you set after the << is relative to how far into a binary sequence you are.
0:1
1:2
2:4
3:8
4:16
5:32
6:64
If you can't find the pattern then you have so very much to learn.
In addition:
Attachment 400
Rather basic but you can google for other pages, pretty much teaches you all of basic C++(syntax and keywords).