Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Although this code is likely to perform the division correctly, it is not guaranteed to. If x has a signed type and a negative value, the operation is implementation-defined and could can be implemented as either an arithmetic shift or a logical shift. In the event of a logical shift, if the integer is represented in either one's complement or two's complement form, the most significant bit (which controls the sign in a different way for both representations) will be set to zero. This will cause a once negative number to become a possibly very large, positive number. For more details, see INT13-A. Use bitwise operators only on unsigned operands.

...