posted 24 years ago
( dunno why this < < l gets displayed in an odd way, maybe its taking my plaintext msg to be an html one substitute i < < l .. in the text for expr suitably)
well, i think its done this way,
int i,j
long l
j=expr
1. the left hand side of the shift, i is int, and that will be the datatype of the shift expression expr
2. since it is being assgned to an int, compiler doesnt object
3. when the left hand side is an int, only the 5 relevent bits of the righthandside ( the lowest order bits ) ( l) are considered for shifting.
note that this is why when we shift an int by more than 32, only modulo 32 value is considered.
( as 32 is the maximum number of bits by which an int can be shifted, and 2 raised to power 5 = 32 etc.. )
cheers,
vivek
[This message has been edited by vivek rai (edited July 25, 2000).]
[This message has been edited by vivek rai (edited July 25, 2000).]
[This message has been edited by vivek rai (edited July 25, 2000).]
[This message has been edited by vivek rai (edited July 25, 2000).]