Skip to content

Commit

Permalink
Use IntPtr instead of int conversion for pointer in Memory.Pin() (mic…
Browse files Browse the repository at this point in the history
…rosoft#10485)

* Use IntPtr instead of int conversion for pointer in Memory.Pin()
Co-authored-by: Lingfeng Wu <lingfw@microsoft.com>
fillmore authored Feb 16, 2022
1 parent d198fbc commit 3be3db5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -248,7 +248,7 @@ public override MemoryHandle Pin(int elementIndex = 0)
{
throw new ArgumentOutOfRangeException(nameof(elementIndex));
}
return new MemoryHandle((void*)((int)_dataBufferPointer + elementIndex * ElementWidth)); //could not use Unsafe.Add
return new MemoryHandle(new IntPtr(_dataBufferPointer.ToInt64() + (long)elementIndex * ElementWidth).ToPointer());
}
}

0 comments on commit 3be3db5

Please sign in to comment.