yeah..Ros...
i could come up with equally +ve shift as u have 2<<30 after shown that only 5 LSB are used and in long only 6 LSB are used. actually, i didnt give thought to long
the reason i came up with such long theory to follow is, 'coz i started out with the thing in mind that when we do shifting left we "multiply" the number and when we do right shift we divide the no. (by 2 in each case). so, the logic i shd 've shd make some sense. i thought when we have right operand +ve. we can say that the left operand will be shifted as many times as i can shift my right operand to right till i get zero.
so, if i 've 4<<2 it means, 4 is multiplied by 2^2 (=0100) and so 4 must be shifted twice as,
0100 Shift right-----> 0010 Shift Right----> 0001 (can't go beyond as actually we 'll 've only integral part after division each time and so LSB in last stage is actually 0 (complice to my logic for -ve right operand but there i've requirement of +3 here and it is +1).
so, i reasoned in the manner i did. yeah but i agree that was little complex to follow first time. and i forgot to consider longs in it...
its easier to remember the way u phrased the theory in a single sentence
regards
maulin