C
christian.bau
Then why did the compiler not make a working code for such a missing
instruction? Isn't that a fault of the compiler?
The result of right shifting negative numbers is implementation
defined. If you rely on a specific result and don't get it, that's
your own fault. As a consequence, my code won't ever rely on such a
result (usually right shifting a negative number is a bug in someone's
code anyway). It would be a very bad idea for the compiler writer to
create slower code for _all_ right shifts of integers just to give you
the result that you expect in a situation where you have no right to
expect anything.