Hey i was trying to run the following block of code which actually Right shifts a Negative Integer number using negative shift value. Something like (negative integer)>>(negative shift value)
.
But interestingly what is found is that what is that whatever the value of shift & The value of integer every time it produces a result of -1
. Plz Explain why the answer is always -1
.
Example:
-8>>-9
Result: -1
-10>>-8
Result: -1
-8>>-2
Result: -1
This question is actually about how negative shift values work on negative integer integer values for right shifting using >> and not about simple Binary right shifts.