[Mono-bugs] [Bug 471275] Internal compiler error -> System.OverflowException: Value is greater than Int64.MaxValue

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Feb 1 16:07:23 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=471275

User andyhume32 at yahoo.co.uk added comment
https://bugzilla.novell.com/show_bug.cgi?id=471275#c2


Andy Hume <andyhume32 at yahoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andyhume32 at yahoo.co.uk




--- Comment #2 from Andy Hume <andyhume32 at yahoo.co.uk>  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.


More information about the mono-bugs mailing list