[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 08:40:55 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 rharinath at novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75708
--- shadow/75708 2005-08-04 07:46:00.000000000 -0400
+++ shadow/75708.tmp.9863 2005-08-19 08:40:55.000000000 -0400
@@ -1,13 +1,13 @@
Bug#: 75708
Product: Mono: Compilers
Version: 1.1
OS: All
OS Details: Windows xp/x86, FreeBSD 5.4/x86
-Status: NEW
-Resolution:
+Status: RESOLVED
+Resolution: NOTABUG
Severity: Unknown
Priority: Major
Component: C#
AssignedTo: mono-bugs at ximian.com
ReportedBy: mike at wege.net
QAContact: mono-bugs at ximian.com
@@ -119,6 +119,36 @@
Always. Using mcs or gmcs doesn't make a difference.
Additional Information:
Couldn't find the "Create a new attachment" link - sorry.
+
+------- Additional Comments From rharinath at novell.com 2005-08-19 08:40 -------
+According to the standard, the builtin left-shift overloads are:
+
+ int operator <<(int x, int count);
+ uint operator <<(uint x, int count);
+ long operator <<(long x, int count);
+ ulong operator <<(ulong x, int count);
+
+The byte and short shift operators use the coressponding 'int'
+variants. So, they are red-herrings.
+
+Now, consider the int and long cases. The standard specifies that
+(section 14.8):
+
+ For the predefined operators, the number of bits to shift is
+ computed as follows:
+
+ * When the type of x is int or uint, the shift count is given by
+ the low-order five bits of count. In other words, the shift
+ count is computed from count & 0x1F.
+ * When the type of x is long or ulong, the shift count is given by
+ the low-order six bits of count. In other words, the shift count
+ is computed from count & 0x3F.
+
+ If the resulting shift count is zero, the shift operators simply
+ return the value of x.
+
+Which all goes to show that the current behaviour is correct.
+
More information about the mono-bugs
mailing list