Changes between Version 1 and Version 2 of Ticket #13192, comment 61


Ignore:
Timestamp:
Mar 27, 2015, 9:03:59 AM (4 years ago)
Author:
teor
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13192, comment 61

    v1 v2  
    1313
    1414See http://stackoverflow.com/a/22734721
    15 {{{
    16 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an unsigned type, the value of the result is E1×2E2, reduced modulo one more than the maximum value representable in the result type. If E1 has a signed type and non-negative value, and E1×2E2 is representable in the result type, then that is the resulting value; otherwise, the behaviour is undefined.
     15
     16"The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an unsigned type, the value of the result is E1×2E2, reduced modulo one more than the maximum value representable in the result type. If E1 has a signed type and non-negative value, and E1×2E2 is representable in the result type, then that is the resulting value; otherwise, the behaviour is undefined.
    1717...
    18 If E1 is a signed type with negative value then the behaviour of left shifting is undefined. This is an easy route to undefined behaviour which may easily get overlooked.
    19 }}}
     18If E1 is a signed type with negative value then the behaviour of left shifting is undefined. This is an easy route to undefined behaviour which may easily get overlooked."
    2019
    2120The tests then succeed on OS X 10.10.2 / Xcode 6.3 beta / clang 3.7.0 with integer undefined behaviour checks / x86_64.