Heres my explanation of bitshifting (you said you didn't understand anything other than binary)...
you have a byte (8 bits) and each bit in this byte has a value, as you already know...
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0
so...
0010 0101 = 1+4+32 = 37
But you already know this so moving on quickly. To bit shift a value you basically shift all the bits either to the left or the right. If you bitshift a value right 1 space then it would be like this...
0101 0100 >>1
-----------------------
0010 1010
See, all the numbers have shifted along 1 space.
Now as you go left from the LSB (least significant bit, the one on the far right) you will see that each time the value of the bit is double the value of the last bit, so the LSB has a value of 1 and the next bit along has a value of 2 which is double 1. The next bit has a value of 4 which is double 2.
So if you bitshift the value once left then our value is going to double (times 2), as all the 1's have shifted left and therefore doubled in value. Here is an example with 4 bits (a nibble, bit-nibble-byte, makes sense)...
0101 = 1+4 = 5 <<1
1010 = 1*2+4*2 = 2+8 = 5*2 = 10
The same happens if you bitshift right, except the values are halved and therefore our overall value is divided by 2.
The problem with bitshifting is that you can loose values off of the end of the group of bits. Like this...
0101 >>1
0010
See, we lost a one off the end so the result isnt the same as 5/2 (2.5) it's 2. This is an advantage sometimes though, for example when you need to compress a value.
If we had an 8 bit colour value (up to 255 like in DB) and we wanted to compress it into a 5 bit value then you would want to get rid of the value bits, so you would shift the bits right. Lets just make the value 255 to be easy...
1111 1111 = 255 >>3
0001 1111 = 31
31 is the maximum value you can have with 5 bits, so the value is compressed but still the maximum. Now if you had 3 colour values and you wanted to compress them into a 16 bit colour, you need to bitshift them to make them all 5 bits so that they fit into 2 bytes (5*3 = 15)...
redBit = red/(256/2^5)
grnBit = grn/(256/2^5)
bluBit = blu/(256/2^5)
256/2^5 is the same as 256/32 is the same as 8 so 255/8 is the same as bishifting the value right 3 (try it and see).
Then we have these values, say the 8 bit values were 255,16 and 200...
RED 1111 1111 = 255 >>3
GRN 0000 1000 = 16 >>3
BLU 0110 0100 = 200 >>3
--------------------------
RED 0001 1111 = 31
GRN 0000 0001 = 1
BLU 0000 1100 = 12
Then we want to fit them all into 2 bytes, but we want each of the five bit values to be separate so we can read them out again easily, the zeros are just as important as the 1s, we dont want to loose them. So we bitshift the values left (we need 16 bits to do this without bits falling off the end)...
newBlue = blue*2^10
newGreen = green*2^5
newRed = red
RED 0000 0000 0001 1111
GRN 0000 0000 0000 0001 <<5
BLU 0000 0000 0000 1100 <<10
RED 0000 0000 0001 1111
GRN 0000 0000 0010 0000
BLU 0011 0000 0000 0000
or to make it look easier I'll group the bits in 5s...
RED 0 00000 00000
11111
GRN 0 00000
00001 00000
BLU 0
01100 00000 00000
Then we add the values together...
RED 0 00000 00000
11111
GRN 0 00000
00001 00000 +
BLU 0
01100 00000 00000 +
----------------------------------------
COL 0
01100 00001 11111
Now you can see that all the colour values are on there own and are compressed from 3 bytes into 2 bytes...
Now to get the values back I guess that you just bitshift them to the rightmost five bits and AND them into another byte. Here is how to and bits...
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0
so if I and the first value out (red)...
0 01100 00001 11111
AND
0 00000 00000 11111
--------------------------
0 00000 00000 11111 = red
then Ive bitshifted the values right 5 (you can imagine that) and I and the Green value out...
0 00000 01100 00001
AND
0 00000 00000 11111
--------------------------
0 00000 00000 00001 = green
and then bitshift and AND the blue...
0 00000 00000 01100
AND
0 00000 00000 11111
--------------------------
0 00000 00000 01100 = blue
Then you have your values back...
RED 0001 1111 = 31
GRN 0000 0001 = 1
BLU 0000 1100 = 12
I hope I made sense. Hopefully with ravens and mine it will.
(Hope this doesnt cut off, Ive copied it just incase, dont know why Im writing this bit cos you wont be able to see it if it does cut off, lol!!!)
Yum! Yum! Yum! Yum!