[profiles] Fix MOBILE assemblies and tests compilation + Rename MOBILE to AOT_HYBRID
[mono.git] / mcs / class / corlib / System / UIntPtr.cs
index 50ec25f03af94bf40803c360cd870e16a1f12eab..3d0fd967aa9983a6d0c58c00f8287b049e60da9e 100644 (file)
@@ -39,6 +39,7 @@
 using System.Globalization;
 using System.Runtime.Serialization;
 using System.Runtime.InteropServices;
+using System.Runtime.ConstrainedExecution;
 
 namespace System
 {
@@ -103,7 +104,7 @@ namespace System
 
                public override string ToString ()
                {
-                       return ((uint) _pointer).ToString();
+                       return UIntPtr.Size < 8 ? ((uint) _pointer).ToString() : ((ulong) _pointer).ToString();
                }
 
                // Interface ISerializable
@@ -160,5 +161,25 @@ namespace System
                public static int Size {
                        get { return sizeof (void*); }
                }
+
+               public static UIntPtr Add (UIntPtr pointer, int offset)
+               {
+                       return (UIntPtr) (unchecked (((byte *) pointer) + offset));
+               }
+
+               public static UIntPtr Subtract (UIntPtr pointer, int offset)
+               {
+                       return (UIntPtr) (unchecked (((byte *) pointer) - offset));
+               }
+
+               public static UIntPtr operator + (UIntPtr pointer, int offset)
+               {
+                       return (UIntPtr) (unchecked (((byte *) pointer) + offset));
+               }
+
+               public static UIntPtr operator - (UIntPtr pointer, int offset)
+               {
+                       return (UIntPtr) (unchecked (((byte *) pointer) - offset));
+               }
        }
 }