Add MemoryCompare, MemoryClear and MemoryCopy for direct memory access in C#

This commit is contained in:
Wojtek Figat
2021-05-30 14:11:25 +02:00
parent 1bd109395a
commit 9c66ac4656
6 changed files with 56 additions and 26 deletions

View File

@@ -84,7 +84,7 @@ namespace FlaxEngine.Json
if (toRead <= 0)
return 0;
fixed (byte* bufferPtr = buffer)
Utils.MemoryCopy(new IntPtr(_ptr + _pos), new IntPtr(bufferPtr), toRead);
Utils.MemoryCopy(new IntPtr(bufferPtr), new IntPtr(_ptr + _pos), (ulong)toRead);
_pos += toRead;
return toRead;
}
@@ -135,7 +135,7 @@ namespace FlaxEngine.Json
if (newPos > _length)
_length = newPos;
fixed (byte* bufferPtr = buffer)
Utils.MemoryCopy(new IntPtr(_pos + _pos), new IntPtr(bufferPtr), count);
Utils.MemoryCopy(new IntPtr(bufferPtr), new IntPtr(_pos + _pos), (ulong)count);
_pos = newPos;
}