using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Threading;
class C
{
private readonly static int[] _perm = [1,2,3,4];
[MethodImpl(MethodImplOptions.NoInlining)]
public int Hash(int value)
{
return _perm[value & (_perm.Length - 1)];
}
static void Main()
{
var c = new C();
for (var i = 0; i < 1000; i++) // triggers tier-1
{
c.Hash(i);
Thread.Sleep(1);
}
}
}
Description
Repro:
On .NET 9:
On main:
Configuration
.NET 9, .NET 10 nightly
Regression?
Yes