[Mono-bugs] [Bug 75708][Maj] Changed - Numerical shifting of large integers doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Aug 19 12:56:03 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by kornelpal at hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=75708

--- shadow/75708	2005-08-19 10:32:23.000000000 -0400
+++ shadow/75708.tmp.13116	2005-08-19 12:56:03.000000000 -0400
@@ -251,6 +251,25 @@
 s64: 1
 u64: 1
 
 It cannot possibly be correct that shifting for 8/16 bit integers
 behaves differently from 32/64 bit integers - right?
 
+
+------- Additional Comments From kornelpal at hotmail.com  2005-08-19 12:56 -------
+I got exactly the same result on .NET Framework 1.1, 2.0 Beta 2 and 
+Mono. The same you got. I don't see any difference in the results.
+
+As Raja R Harinath pointed out there are only 32-bit and 64-bit 
+shifting operators. This means that 8-bit and 16-bit numbers cannot 
+be shifted.
+
+The compiler does the following to make shifting 8-bit and 16-bit 
+numbers possible:
+
+s8 = (sbyte)((int)s8 << 8);
+u8 = (byte)((uint)u8 << 8);
+s16 = (short)((int)s16 << 16);
+u16 = (ushort)((uint)u16 << 16);
+
+You can try to replace your code with this, compile, and compare 
+ildasm results. They has to be the same.


More information about the mono-bugs mailing list