} catch (System.OverflowException) {}
try {
- return CheckSub((short*)(-1), int.MaxValue);
+ if (IntPtr.Size <= 4)
+ return CheckSub((short*)(-1), int.MaxValue);
+ else
+ return CheckSub((short*)(-1), long.MaxValue);
} catch (System.OverflowException) {}
CheckSub2((short*)(-1), int.MaxValue);
return 102;
}
+ unsafe static int CheckSub(short* ptr, long offset)
+ {
+ if (checked(ptr - offset < ptr))
+ return 2;
+
+ return 102;
+ }
+
unsafe static int CheckSub2(short* ptr, int offset)
{
short* b = ptr + offset;