Thread overview
[Issue 24879] Unexpected sign extension after shifting a ubyte and promoting to ulong
[Issue 24879] Weird bug...
Nov 25
Dennis
Nov 25
Manu
November 25
https://issues.dlang.org/show_bug.cgi?id=24879

--- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> ---
Well, yes, bytes[4] << 24 == 0xffffffff9a000000, try it.

--
November 25
https://issues.dlang.org/show_bug.cgi?id=24879

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl
            Summary|Weird bug...                |Unexpected sign extension
                   |                            |after shifting a ubyte and
                   |                            |promoting to ulong
           Severity|normal                      |enhancement

--- Comment #2 from Dennis <dkorpel@live.nl> ---
`bytes[4] << 24` gets promoted to int, and sign extended when or'd with a ulong. The same happens in C, and D committed to having the same integer promotion rules as C, so I don't see much that can be done here. Do you have a suggestion?

--
November 25
https://issues.dlang.org/show_bug.cgi?id=24879

Manu <turkeyman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Manu <turkeyman@gmail.com> ---
Oh wow; my bad. That's so obvious in retrospect, and terrible.

--
November 25
https://issues.dlang.org/show_bug.cgi?id=24879

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|http://dlang.org/           |
         Resolution|FIXED                       |WONTFIX

--