Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Plural to singular edits that were missed; NFC

...

GCC has no options to handle shifts by negative amounts or by amounts outside the width of the type predictably or to trap on them; they are always treated as undefined. Processors may reduce the shift amount modulo the width of the type. For example, 32-bit right shifts are implemented using the following instructions instruction on x86-32:

Code Block
sarl   %cl, %eax

The sarl instructions take instruction takes a bit mask of the least significant 5 bits from %cl to produce a value in the range [0, 31] and then shift %eax that many bits:

...