This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C51 Shifting integers

Trying to determine the behavior of the C51 compiler when performing a '>>' on a negative integer.

The C90 indicates that this is compiler implementation dependent.

Will the compiler shift the sign, or does it insert 0's?

Thanks in advance for any replies.

Parents
  • Unfortunately I don't have access to the compiler. The code was written a number of years ago, and the algorithm has since been ported (re-written) to another design.  I am not responsible for either design, but am trying to understand why the two systems give different results. I just noticed in the original source that a right shift was being applied to an integer and wanted to confirm it was working as intended.

Reply
  • Unfortunately I don't have access to the compiler. The code was written a number of years ago, and the algorithm has since been ported (re-written) to another design.  I am not responsible for either design, but am trying to understand why the two systems give different results. I just noticed in the original source that a right shift was being applied to an integer and wanted to confirm it was working as intended.

Children