Skip to content

Commit

Permalink
直接使用指针转换,提升性能
Browse files Browse the repository at this point in the history
  • Loading branch information
egametang committed Dec 18, 2018
1 parent 6b5c160 commit 246d9f1
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ public unsafe StackObject* ValueLong
{
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;
}
}
}

Expand Down

0 comments on commit 246d9f1

Please sign in to comment.