When performing a right bitshift on negative integers, the sign bit is not preserved.
|
|
Resolved
Negative integers will now fill with 1's in the leading bits when bitshifting right. The BitshiftRightRotate() method is unaffected by this change.
|
BYOND Version: | 511 |
Operating System: | Windows 10 Home 64-bit |
Web Browser: | Firefox 57.0 |
Applies to: | DM Language |
|
Status: |
Resolved (b1.2.2.20171227)
This issue has been resolved.
|
|
|
Descriptive Problem Summary:
When performing a right bitshift on negative integers (i.e., of the Signed32 class), the sign bit is not preserved. E.g., 0x80000000 >> 1 = 0x40000000 instead of 0xC0000000 as expected.
Code Snippet (if applicable) to Reproduce Problem:
var/pif_LongInt/Signed32/A = new("0x8000000") A >>= 1 world << A.PrintHex()
Expected Results:
0xC0000000 is output.
Actual Results:
0x40000000 is output.
|
I'm leaving it as a Bug Report because it seems more appropriate than a Feature Request.