Aetheria/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/CustomPartition.cs
hyperion51 c24c155673 Context Menus & Progress Bars
We now have a context menu UI for in-game actions, right click on an item to activate
Database view has a progress bar (finally!)
Data structures for Megacorps and loadouts
Towing task complete? needs testing
2020-05-10 00:16:33 +01:00

38 lines
No EOL
1 KiB
C#

#if !(UNITY_4 || UNITY_5)
using System;
using System.Collections.Concurrent;
namespace JM.LinqFaster.Utils
{
internal static class CustomPartition
{
public static OrderablePartitioner<Tuple<int,int>> MakePartition(int len, int? batchSize)
{
if (batchSize == null)
{
return Partitioner.Create(0, len);
}
else
{
return Partitioner.Create(0, len, batchSize.Value);
}
}
public static OrderablePartitioner<Tuple<int, int>> MakeSIMDPartition(int len, int chunkSize, int? batchSize)
{
int chunkLen = len - len % chunkSize;
int numChunks = chunkLen / chunkSize;
if (batchSize == null)
{
return Partitioner.Create(0, numChunks,numChunks/Environment.ProcessorCount);
}
else
{
return Partitioner.Create(0, numChunks, batchSize.Value);
}
}
}
}
#endif