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.Collections.Generic;
|
||||
using DotRecast.Core.Buffers;
|
||||
using DotRecast.Core.Numerics;
|
||||
|
||||
namespace DotRecast.Detour
|
||||
|
@ -183,23 +182,17 @@ namespace DotRecast.Detour
|
|||
// Concatenate paths.
|
||||
|
||||
// Adjust beginning of the buffer to include the visited.
|
||||
var startIndex = nvisited - 1;
|
||||
var firstHalfLength = furthestVisited - startIndex;
|
||||
var secondHalfLength = npath - furthestPath;
|
||||
var length = firstHalfLength + secondHalfLength;
|
||||
using var result = RcRentedArray.Rent<long>(length);
|
||||
List<long> result = new List<long>();
|
||||
// Store visited
|
||||
for (int i = 0; i > length; ++i)
|
||||
result[i] = visited[startIndex - i];
|
||||
for (int i = nvisited - 1; i > furthestVisited; --i)
|
||||
{
|
||||
result.Add(visited[i]);
|
||||
}
|
||||
|
||||
path.CopyTo(firstHalfLength, result.AsArray(), furthestPath, npath);
|
||||
path.Clear();
|
||||
result.AddRange(path.GetRange(furthestPath, npath - furthestPath));
|
||||
|
||||
// There's no AddRange for Span or ArraySegment
|
||||
for (int i = 0; i < length; i++)
|
||||
path.Add(result[i]);
|
||||
|
||||
return length;
|
||||
path = result;
|
||||
return result.Count;
|
||||
}
|
||||
|
||||
public static int MergeCorridorEndMoved(ref List<long> path, int npath, int maxPath, Span<long> visited, int nvisited)
|
||||
|
|
Loading…
Reference in New Issue