VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Yep... Rag on a Stick (5 replies, 0 views) (2000-Sep-5) Bitshifting will basically divide by 2, or multiply by 2 (multiple times if necessary), it can be used for other stuff, but that is probably the simplest. It works like this, say you have a Byte, like 64, it is represented in binary by this:
01000000
So if we bitshift to the right, what happens is this:
00100000
Or if we go to the left, we get this:
10000000
Now, imagine you are doing this with a number using decimals (Base 10)
55.0 (The 0 makes it easier to understand)
If we bitshift in decimal, we are just moving the decimal point, so left would make it
5.50
And right
550.0
So we are just dividing it by 10 (left) or multiplying it by 10 (right)
When we work in binary (base 2), the same thing happens, except, instead of being by 10s, it is by 2s (since it is binary).
hth
|