H
Hannes Allmaier
Hi!
I found interesting code in a Visualc++-file (all variables are unsigned
integers)
return (CurrentBfr << (32 - BitsLeft)) >> (32 - N);;
so it seems the return value gets right shifted (32-N) times, like this
return(CurrentBfr << (32 - BitsLeft))>> (32 - N);
Interesting that this actually works, however even more interesting why
my simplification
return(CurrentBfr>>(Bitsleft-N));
doesn't work. If a left shift corresponds to a multiplication and a
right shift to a division by 2, this should be ok.
Could somebody enlighten me?
Thanks! Hannes
I found interesting code in a Visualc++-file (all variables are unsigned
integers)
return (CurrentBfr << (32 - BitsLeft)) >> (32 - N);;
so it seems the return value gets right shifted (32-N) times, like this
return(CurrentBfr << (32 - BitsLeft))>> (32 - N);
Interesting that this actually works, however even more interesting why
my simplification
return(CurrentBfr>>(Bitsleft-N));
doesn't work. If a left shift corresponds to a multiplication and a
right shift to a division by 2, this should be ok.
Could somebody enlighten me?
Thanks! Hannes