X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem%2FIntPtr.cs;h=c449de83997a3b308b1df8fbe881eb053f166dc3;hb=44bccacc1298ec1c5d6225d560094def47044c4f;hp=e594d49bbb90907f87642d9eaefbc53af8327b71;hpb=93ce056a764e8048f33548a3744ba2bd84072043;p=mono.git diff --git a/mcs/class/corlib/System/IntPtr.cs b/mcs/class/corlib/System/IntPtr.cs index e594d49bbb9..c449de83997 100644 --- a/mcs/class/corlib/System/IntPtr.cs +++ b/mcs/class/corlib/System/IntPtr.cs @@ -45,6 +45,7 @@ using System.Globalization; using System.Runtime.Serialization; using System.Runtime.ConstrainedExecution; +using System.Diagnostics.Contracts; namespace System { @@ -223,5 +224,13 @@ namespace System { return (IntPtr) (unchecked (((byte *) pointer) - offset)); } + + // fast way to compare IntPtr to (IntPtr)0 while IntPtr.Zero doesn't work due to slow statics access + [Pure] + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] + internal unsafe bool IsNull() + { + return m_value == null; + } } }