Skip to content

Commit

Permalink
Add argument check for matLerp
Browse files Browse the repository at this point in the history
  • Loading branch information
OliBomby committed Dec 3, 2023
1 parent 46c9471 commit 0f8d3cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion osu.Framework/Utils/PathApproximator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,12 @@ private static void adamUpdate(float[,] parameters, float[,] m, float[,] v, int
}
}

// mat1 can not be the same array as result, or it will not work correctly
private static unsafe void matLerp(float[,] mat1, float[,] mat2, float t, float[,] result)
{
// mat1 can not be the same array as result, or it will not work correctly
if (ReferenceEquals(mat1, result))
throw new ArgumentException($"{nameof(mat1)} can not be the same array as {nameof(result)}.");

fixed (float* mat1P = mat1, mat2P = mat2, resultP = result)
{
var span1 = new Span<float>(mat1P, mat1.Length);
Expand Down

0 comments on commit 0f8d3cc

Please sign in to comment.