Fixed invalid index return when EnvironmentConfig.RollingAccelerators is 1.

This commit is contained in:
mlemanczyk committed 2025-12-28 00:14:23 +01:00
1 parent 3342ead2d4
commit 759614de54
1 file changed
+2 -2
+2 -2
View File
@@ -16,8 +16,8 @@ namespace PerfectNumbers.Core.Gpu
public int Rent()
{
_ = Interlocked.CompareExchange(ref _index, Capacity, 0);
var index = Interlocked.Increment(ref _index);
if (index >= Capacity)
var index = Interlocked.Increment(ref _index) - 1;
if (index + 1 >= Capacity)
{
index -= Capacity;
}