Răsfoiți Sursa

直接使用指针转换,提升性能

tanghai 7 ani în urmă
părinte
comite
246d9f1440

+ 10 - 4
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/Stack/StackObject.cs

@@ -20,13 +20,19 @@ namespace ILRuntime.Runtime.Stack
         {
             get
             {
-                return (StackObject*)((uint)Value << 32 | (uint)this.ValueLow);
+                fixed (int* i = &this.Value)
+                {
+                    ulong* p = (ulong*) i;
+                    return (StackObject*) (*p);
+                }
             }
             set
             {
-                ulong v = (ulong) value;
-                this.ValueLow = (int)(v & 0x00000000ffffffff);
-                this.Value = (int)(v >> 32);
+                fixed (int* i = &this.Value)
+                {
+                    ulong* p = (ulong*) i;
+                    *p = (ulong)value;
+                }
             }
         }