Skip to content

Commit

Permalink
readonly struct -> readonly ref struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Dec 14, 2024
1 parent ea71ed0 commit 14c3423
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/DotRecast.Core/RcScopedTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace DotRecast.Core
{
public readonly struct RcScopedTimer : IDisposable
public readonly ref struct RcScopedTimer
{
private readonly RcContext _context;
private readonly RcTimerLabel _label;
Expand Down
17 changes: 11 additions & 6 deletions src/DotRecast.Core/RcThrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ public static void ThrowExceptionIfIndexOutOfRange(int index, int size)
throw new IndexOutOfRangeException($"Index {index} is out of range - size({size})");
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ThrowArgumentOutOfRangeException(string argument)
{
throw new ArgumentOutOfRangeException(argument);
}


[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ThrowNullReferenceException(string argument)
{
throw new NullReferenceException(argument);
}


[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void StackOverflow()
{
Expand All @@ -34,15 +41,13 @@ public static void StackOverflow()
var array_8_512_1 = RcStackArray8<RcStackArray512<float>>.Empty; // 8 * 512 = 4196
var array_4_256_1 = RcStackArray4<RcStackArray256<float>>.Empty; // 4 * 256 = 1024
var array_4_64_1 = RcStackArray4<RcStackArray64<float>>.Empty; // 4 * 64 = 256

//
var array_2_8_1 = RcStackArray2<RcStackArray8<float>>.Empty; // 2 * 8 = 16
var array_2_4_1 = RcStackArray2<RcStackArray2<float>>.Empty; // 2 * 2 = 4

float f1 = 0.0f; // 1

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-6

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-6

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-7

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-8

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-8

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-9

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-6

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-6

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-7

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-9

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-8

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-8

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-8

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-8

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-7

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-9

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-6

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-6

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The variable 'f1' is assigned but its value is never used

Check warning on line 49 in src/DotRecast.Core/RcThrowHelper.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The variable 'f1' is assigned but its value is never used
//float f2 = 0.0f; // my system stack overflow!
}


}
}
2 changes: 1 addition & 1 deletion src/DotRecast.Detour.Crowd/DtCrowdScopedTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace DotRecast.Detour.Crowd
{
internal readonly struct DtCrowdScopedTimer : IDisposable
internal readonly ref struct DtCrowdScopedTimer
{
private readonly DtCrowdTimerLabel _label;
private readonly DtCrowdTelemetry _telemetry;
Expand Down

0 comments on commit 14c3423

Please sign in to comment.