Skip to content

Commit

Permalink
✨ Implement int array Copy with offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Mar 1, 2024
1 parent 29cea4e commit 921695c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions source/Cosmos.Core/MemoryOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,24 @@ public static unsafe void Copy(byte[] aDest, int aDestOffset, byte[] aSrc, int a
}
}

/// <summary>
/// Copy source int array to destination int array.
/// </summary>
/// <param name="dest">Destination int array.</param>
/// <param name="destOffset">Destination offset in int elements, not bytes.</param>
/// <param name="src">Source int array.</param>
/// <param name="srcOffset">Source offset in int elements, not bytes.</param>
/// <param name="count">Count of int elements to copy, not bytes.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void Copy(int[] dest, int destOffset, int[] src, int srcOffset, int count)
{
fixed (int* destPtr = &dest[destOffset])
fixed (int* srcPtr = &src[srcOffset])
{
Copy(destPtr, srcPtr, count);
}
}

#endregion Copy
}
}

0 comments on commit 921695c

Please sign in to comment.