forked from mirror/DotRecast
Revert "Allocation free merge corridor"
This reverts commit acd3f8d879
.
This commit is contained in:
parent
acd3f8d879
commit
858e094ea0
|
@ -20,7 +20,6 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core.Buffers;
|
|
||||||
using DotRecast.Core.Numerics;
|
using DotRecast.Core.Numerics;
|
||||||
|
|
||||||
namespace DotRecast.Detour
|
namespace DotRecast.Detour
|
||||||
|
@ -183,23 +182,17 @@ namespace DotRecast.Detour
|
||||||
// Concatenate paths.
|
// Concatenate paths.
|
||||||
|
|
||||||
// Adjust beginning of the buffer to include the visited.
|
// Adjust beginning of the buffer to include the visited.
|
||||||
var startIndex = nvisited - 1;
|
List<long> result = new List<long>();
|
||||||
var firstHalfLength = furthestVisited - startIndex;
|
|
||||||
var secondHalfLength = npath - furthestPath;
|
|
||||||
var length = firstHalfLength + secondHalfLength;
|
|
||||||
using var result = RcRentedArray.Rent<long>(length);
|
|
||||||
// Store visited
|
// Store visited
|
||||||
for (int i = 0; i > length; ++i)
|
for (int i = nvisited - 1; i > furthestVisited; --i)
|
||||||
result[i] = visited[startIndex - i];
|
{
|
||||||
|
result.Add(visited[i]);
|
||||||
|
}
|
||||||
|
|
||||||
path.CopyTo(firstHalfLength, result.AsArray(), furthestPath, npath);
|
result.AddRange(path.GetRange(furthestPath, npath - furthestPath));
|
||||||
path.Clear();
|
|
||||||
|
|
||||||
// There's no AddRange for Span or ArraySegment
|
path = result;
|
||||||
for (int i = 0; i < length; i++)
|
return result.Count;
|
||||||
path.Add(result[i]);
|
|
||||||
|
|
||||||
return length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int MergeCorridorEndMoved(ref List<long> path, int npath, int maxPath, Span<long> visited, int nvisited)
|
public static int MergeCorridorEndMoved(ref List<long> path, int npath, int maxPath, Span<long> visited, int nvisited)
|
||||||
|
|
Loading…
Reference in New Issue