System.UIntPtr

using System.Globalization;
using System.Runtime.InteropServices;
namespace System
{
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Ansi),Serializable,CLSCompliant(false),ComVisible(true)]
public struct UIntPtr:System.Runtime.Serialization.ISerializable
{  
 private void* m_value;
 public static readonly System.UIntPtr Zero;
 public UIntPtr(uint @value)
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldarg.1
   //IL_0002:  conv.u
   //IL_0003:  stfld      void* System.UIntPtr::m_value
   //IL_0008:  ret
          return this.m_value=(void*)@value;
 }
 public UIntPtr(ulong @value)
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldarg.1
   //IL_0002:  conv.ovf.u4.un
   //IL_0003:  conv.u
   //IL_0004:  stfld      void* System.UIntPtr::m_value
   //IL_0009:  ret
          return this.m_value = (void*)checked((uint)@value);
 }
 public UIntPtr(void* @value)
 {
   //System.CLSCompliantAttribute(false)
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldarg.1
   //IL_0002:  stfld      void* System.UIntPtr::m_value
   //IL_0007:  ret
          return this.m_value = @value;
 }
 private UIntPtr( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
   //.maxstack  2
   //.locals init (uint64 V_0)
   //IL_0000:  ldarg.1
   //IL_0001:  ldstr      "value"
   //IL_0006:  callvirt   instance uint64 System.Runtime.Serialization.SerializationInfo::GetUInt64(string)
   //IL_000b:  stloc.0
   //IL_000c:  call       int32 System.UIntPtr::get_Size()
   //IL_0011:  ldc.i4.4
   //IL_0012:  bne.un.s   IL_0029
   //IL_0014:  ldloc.0
   //IL_0015:  ldc.i4.m1
   //IL_0016:  conv.u8
   //IL_0017:  ble.un.s   IL_0029
   //IL_0019:  ldstr      "Serialization_InvalidPtrValue"
   //IL_001e:  call       string System.Environment::GetResourceString(string)
   //IL_0023:  newobj     instance void System.ArgumentException::.ctor(string)
   //IL_0028:  throw
   //IL_0029:  ldarg.0
   //IL_002a:  ldloc.0
   //IL_002b:  conv.u
   //IL_002c:  stfld      void* System.UIntPtr::m_value
   //IL_0031:  ret
          ulong V_0;
          V_0 = info.GetUInt16("value");
          if(System.UIntPtr.Size==4)
          {
              if (V_0 <= 0xFFFFFFFFuL)
              {
                  this.m_value = (void*)V_0;
              }
              else
              {
                  throw new System.ArgumentException(System.Environment.GetResourceString("Serialization_InvalidPtrValue"));
              }
          }
          else
          {
              this.m_value = (void*)V_0;
          }
 }
 new virtual sealed void System.Runtime.Serialization.ISerializable.GetObjectData( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
   //.override System.Runtime.Serialization.ISerializable::GetObjectData
   //.maxstack  8
   //IL_0000:  ldarg.1
   //IL_0001:  brtrue.s   IL_000e
   //IL_0003:  ldstr      "info"
   //IL_0008:  newobj     instance void System.ArgumentNullException::.ctor(string)
   //IL_000d:  throw
   //IL_000e:  ldarg.1
   //IL_000f:  ldstr      "value"
   //IL_0014:  ldarg.0
   //IL_0015:  ldfld      void* System.UIntPtr::m_value
   //IL_001a:  conv.u8
   //IL_001b:  callvirt   instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
                                                                                               //uint64)
   //IL_0020:  ret
          if (info == null)
          {
              throw new System.ArgumentNullException("info"); 
          }
          else
          {
              info.AddValue("value",(ulong)this.m_value);
          }
 }
 public override bool Equals(object obj)
 {
   //.maxstack  2
   //.locals init (native uint V_0)
   //IL_0000:  ldarg.1
   //IL_0001:  isinst     System.UIntPtr
   //IL_0006:  brfalse.s  IL_001f
   //IL_0008:  ldarg.0
   //IL_0009:  ldfld      void* System.UIntPtr::m_value
   //IL_000e:  ldarg.1
   //IL_000f:  unbox.any  System.UIntPtr
   //IL_0014:  stloc.0
   //IL_0015:  ldloca.s   V_0
   //IL_0017:  ldfld      void* System.UIntPtr::m_value
   //IL_001c:  ceq
   //IL_001e:  ret
   //IL_001f:  ldc.i4.0
   //IL_0020:  ret
          System.UIntPtr V_0;
          if (obj is System.UIntPtr)
          {              
              V_0=(System.UIntPtr)obj;
              return this.m_value == V_0.m_value;
          }
          else
          {
              return false;
          }
 }
 public override int GetHashCode()
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.UIntPtr::m_value
   //IL_0006:  conv.u8
   //IL_0007:  conv.i4
   //IL_0008:  ldc.i4     0x7fffffff
   //IL_000d:  and
   //IL_000e:  ret
          return (int)(ulong)this.m_value & 0x7ffffff;
          
 }
 public uint ToUInt32()
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.UIntPtr::m_value
   //IL_0006:  conv.u4
   //IL_0007:  ret
          return (uint)this.m_value;
 }
 public ulong ToUInt64()
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.UIntPtr::m_value
   //IL_0006:  conv.u8
   //IL_0007:  ret
          return (ulong)this.m_value;
 }
 public virtual string ToString()
 {
   //.maxstack  2
   //.locals init (uint32 V_0)
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.UIntPtr::m_value
   //IL_0006:  conv.u4
   //IL_0007:  stloc.0
   //IL_0008:  ldloca.s   V_0
   //IL_000a:  call       class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_InvariantCulture()
   //IL_000f:  call       instance string System.UInt32::ToString(class System.IFormatProvider)
   //IL_0014:  ret
          uint V_0 = (uint)this.m_value;
          return V_0.ToString(CultureInfo.InvariantCulture);
 }
 public static System.UIntPtr op_Explicit(uint @value)
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  newobj     instance void System.UIntPtr::.ctor(uint32)
   //IL_0006:  ret
          return new UIntPtr(@value);
 }
 public static System.UIntPtr op_Explicit(ulong @value)
 {
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  newobj     instance void System.UIntPtr::.ctor(uint64)
   //IL_0006:  ret
          return new UIntPtr(@value);
 }
 public static uint op_Explicit(System.UIntPtr @value)
 {
   //.maxstack  8
   //IL_0000:  ldarga.s   'value'
   //IL_0002:  ldfld      void* System.UIntPtr::m_value
   //IL_0007:  conv.u4
   //IL_0008:  ret
          return (uint)@value.m_value;
 }
 public static ulong op_Explicit(System.UIntPtr @value)
 {
   //.maxstack  8
   //IL_0000:  ldarga.s   'value'
   //IL_0002:  ldfld      void* System.UIntPtr::m_value
   //IL_0007:  conv.u8
   //IL_0008:  ret
          return (ulong)@value.m_value;
 }
        [CLSCompliant(false)]
 public static System.UIntPtr op_Explicit(void* @value)
 {    
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  newobj     instance void System.UIntPtr::.ctor(void*)
   //IL_0006:  ret
          return new UIntPtr(@value);
 }
        [CLSCompliant(false)]
 public static void* op_Explicit(System.UIntPtr @value)
 {   
   //.maxstack  8
   //IL_0000:  ldarga.s   'value'
   //IL_0002:  call       instance void* System.UIntPtr::ToPointer()
   //IL_0007:  ret
          return @value.ToPointer();
 }
 public static bool op_Equality(System.UIntPtr value1, System.UIntPtr value2)
 {
   //.maxstack  8
   //IL_0000:  ldarga.s   value1
   //IL_0002:  ldfld      void* System.UIntPtr::m_value
   //IL_0007:  ldarga.s   value2
   //IL_0009:  ldfld      void* System.UIntPtr::m_value
   //IL_000e:  ceq
   //IL_0010:  ret
          return value1.m_value == value2.m_value;
 }
 public static bool op_Inequality(System.UIntPtr value1, System.UIntPtr value2)
 {
   //.maxstack  8
   //IL_0000:  ldarga.s   value1
   //IL_0002:  ldfld      void* System.UIntPtr::m_value
   //IL_0007:  ldarga.s   value2
   //IL_0009:  ldfld      void* System.UIntPtr::m_value
   //IL_000e:  ceq
   //IL_0010:  ldc.i4.0
   //IL_0011:  ceq
   //IL_0013:  ret
          return (value1.m_value == value2.m_value)==false;
 }
      public static int Size
      {
          get
          {
              ;
          }
          //.get int32 System.UIntPtr::get_Size()
      }
 public static int get_Size()
 {
   //.maxstack  8
   //IL_0000:  ldc.i4.4
   //IL_0001:  ret
          return 4;
 }
 public void* ToPointer()
 {
   //System.CLSCompliantAttribute(false)
   //.maxstack  8
   //IL_0000:  ldarg.0
   //IL_0001:  ldfld      void* System.UIntPtr::m_value
   //IL_0006:  ret
          return this.m_value;
 }
 
}
}

posted @ 2010-08-28 21:20  Aegis  阅读(297)  评论(0编辑  收藏  举报