russell....@realtimeworlds.com wrote:

> I encountered a problem when casting a long to an IntPtr, which is
> something we have ended up doing a lot (we want to keep binary assembly
> compatibility between x86 and x64, only changing the native code on the
> different architectures). We encountered a problem with Mono as there
> has been a check introduced into the IntPtr constructor from a long,
> this is checking the range of the long to ensure it is in range,
> unfortunately the check is incorrect. A long can easily hold from
> Int32.MinValue to UInt32.MaxValue (and not Int32.MaxValue as it
> currently in there).
> 

The patch is wrong, since casting a long > Int32.MaxValue to a
4 byte signed intptr is simply invalid.

The current check in IntPtr.cs also matches MS.NET.

Robert

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to