hlsf error is solved. HLSF is now full functional available.
This commit is contained in:
@@ -60,9 +60,12 @@ namespace StgSharp.HighPerformance.Memory
|
||||
s = 0;
|
||||
i++;
|
||||
}
|
||||
if (i >= levelSizeArray.Length)
|
||||
if (i > MaxLevel)
|
||||
{
|
||||
if (TryAllocateNew16MBBlock(out handle))
|
||||
if (TryPopLevelForAllocation(10, 1, out handle))
|
||||
{
|
||||
break;
|
||||
} else if (TryAllocateNew32MBBlock(out handle))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -106,7 +109,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
long offset = (long)e->Position - sizeToSlice - (long)m_Buffer; // offset of buffer to slice
|
||||
long end = (long)e->Position - (long)m_Buffer; // end offset of buffer to slice
|
||||
|
||||
int i = (BitOperations.TrailingZeroCount(remain) - 6) / 2;
|
||||
int i = (BitOperations.TrailingZeroCount(offset) - 6) / 2;
|
||||
i = int.Min(10, i);
|
||||
for (; i < levelSizeArray.Length; i++)
|
||||
{
|
||||
@@ -116,7 +119,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
int count = (int)((long.Min(edge, end) - offset) / size);
|
||||
if (count > 0)
|
||||
{
|
||||
int newSize = count * size;
|
||||
long newSize = count * size;
|
||||
|
||||
Entry* newEntry = (Entry*)_entries.Allocate();
|
||||
InsertEntryBefore(newEntry, next);
|
||||
@@ -142,7 +145,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
int count = (int)((long.Min(edge, end) - offset) / upper);
|
||||
if (count > 0)
|
||||
{
|
||||
int newSize = count * upper;
|
||||
long newSize = (long)count * (long)upper;
|
||||
|
||||
Entry* newEntry = (Entry*)_entries.Allocate();
|
||||
InsertEntryBefore(newEntry, next);
|
||||
@@ -153,7 +156,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
b->EntryRef = newEntry;
|
||||
PushBucketToLevel(i, count - 1, b);
|
||||
offset += newSize;
|
||||
remain -= (long)newSize;
|
||||
remain -= newSize;
|
||||
if (remain <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -167,7 +170,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
int count = (int)((long.Min(edge, end) - offset) / size);
|
||||
if (count > 0)
|
||||
{
|
||||
int newSize = count * size;
|
||||
long newSize = count * size;
|
||||
|
||||
Entry* newEntry = (Entry*)_entries.Allocate();
|
||||
InsertEntryBefore(newEntry, next);
|
||||
@@ -180,7 +183,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
b->PreviousLevel = null;
|
||||
PushBucketToLevel(i, count - 1, b);
|
||||
offset += newSize;
|
||||
remain -= (long)newSize;
|
||||
remain -= newSize;
|
||||
}
|
||||
if (remain <= 0) {
|
||||
return;
|
||||
@@ -197,7 +200,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
/// <returns>
|
||||
/// True if allocation succeeded
|
||||
/// </returns>
|
||||
private bool TryAllocateNew16MBBlock(out Entry* handle)
|
||||
private bool TryAllocateNew32MBBlock(out Entry* handle)
|
||||
{
|
||||
nuint pos = _spareMemory->Position;
|
||||
long remain = _spareMemory->Size;
|
||||
@@ -206,7 +209,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
handle = null;
|
||||
return false;
|
||||
}
|
||||
long size = remain > 16 * 1024 * 1024L ? 16 * 1024 * 1024L : remain;
|
||||
long size = remain > 32 * 1024 * 1024L ? 32 * 1024 * 1024L : remain;
|
||||
|
||||
|
||||
// build new entry
|
||||
|
||||
Reference in New Issue
Block a user