Math classes inling optimizations

This commit is contained in:
2026-06-14 01:49:24 +02:00
parent 7b458c4ec8
commit 704ecea09c
6 changed files with 91 additions and 81 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
namespace _2DGAMELIB
{
@@ -21,17 +22,19 @@ namespace _2DGAMELIB
X = x;
Y = y;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double Length()
{
return System.Math.Sqrt(X * X + Y * Y);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double LengthSquared()
{
return X * X + Y * Y;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Normalize()
{
double num = Length();