https://bugzilla.novell.com/show_bug.cgi?id=471275
User [email protected] added comment https://bugzilla.novell.com/show_bug.cgi?id=471275#c2 Andy Hume <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from Andy Hume <[email protected]> 2009-02-01 14:07:22 MST --- Orthogal to the reported problem, and I'm sure you'd have discovered it once the compile was working, but you need some more casts in Lookup(ushort, ushort, ushort, ushort). All the shifts are done on Int32 (the narrowest defined shift operator), so you don't get the answers you wanted! See the sample below, and see e.g. http://www.jaggersoft.com/csharp_standard/14.8.htm for the reasons -- including why deviceID is shifted by 0 bits!! using System; class LeftShifting { static void Main() { Lookup(1, 2, 3, 4); LookupB(1, 2, 3, 4); } public static string Lookup(ushort vendorID, ushort deviceID, ushort subSystem, ushort subVendor) { ulong x = ((ulong)((vendorID << 48) | (deviceID << 32) | (subSystem << 16) | subVendor)); string s = string.Format("Lookup4 x: 0x{0:X16}", x); Console.WriteLine(s); return s; } public static string LookupB(ushort vendorID, ushort deviceID, ushort subSystem, ushort subVendor) { ulong x = ((((ulong)vendorID << 48) | ((ulong)deviceID << 32) | ((ulong)subSystem << 16) | subVendor)); string s = string.Format("Lookup4b x: 0x{0:X16}", x); Console.WriteLine(s); return s; } } -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
