Fixed invalid index return when EnvironmentConfig.RollingAccelerators is 1.
This commit is contained in:
1 parent
3342ead2d4
commit
759614de54
1 file changed
+2
-2
@@ -16,8 +16,8 @@ namespace PerfectNumbers.Core.Gpu
|
|||||||
public int Rent()
|
public int Rent()
|
||||||
{
|
{
|
||||||
_ = Interlocked.CompareExchange(ref _index, Capacity, 0);
|
_ = Interlocked.CompareExchange(ref _index, Capacity, 0);
|
||||||
var index = Interlocked.Increment(ref _index);
|
var index = Interlocked.Increment(ref _index) - 1;
|
||||||
if (index >= Capacity)
|
if (index + 1 >= Capacity)
|
||||||
{
|
{
|
||||||
index -= Capacity;
|
index -= Capacity;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user