V
Vivien Parlat
Hello,
I have a little question about operator >> between integers: does
anyone know why, when I write:
"1 >> x", the returned value is 1 for all values multiple of 32 and 0
else (this does not hurt me, 1 does).
When I do the same thing with : "1L >> x", only multiples of 64 do
this.
I thought 0 was the only possible result for any x > 0.
Why is it not the case ? And how to correct this simply -- in one
instruction, else I did it by:
long longFoo = intBar;
longFoo >>= x;
return (int) longFoo;
.... but this looks weird to do this.
Thanks in advance to any answer.
I have a little question about operator >> between integers: does
anyone know why, when I write:
"1 >> x", the returned value is 1 for all values multiple of 32 and 0
else (this does not hurt me, 1 does).
When I do the same thing with : "1L >> x", only multiples of 64 do
this.
I thought 0 was the only possible result for any x > 0.
Why is it not the case ? And how to correct this simply -- in one
instruction, else I did it by:
long longFoo = intBar;
longFoo >>= x;
return (int) longFoo;
.... but this looks weird to do this.
Thanks in advance to any answer.