From 7aeb31d369c53067e7bf52ab448dbbc8bb5d6a4b Mon Sep 17 00:00:00 2001 From: wrenge Date: Mon, 11 Nov 2024 14:26:35 +0300 Subject: [PATCH] Span access --- src/DotRecast.Core/Buffers/RcRentedArray.cs | 2 +- src/DotRecast.Detour/DtNavMeshQuery.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DotRecast.Core/Buffers/RcRentedArray.cs b/src/DotRecast.Core/Buffers/RcRentedArray.cs index e7809f6..208b951 100644 --- a/src/DotRecast.Core/Buffers/RcRentedArray.cs +++ b/src/DotRecast.Core/Buffers/RcRentedArray.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Runtime.CompilerServices; diff --git a/src/DotRecast.Detour/DtNavMeshQuery.cs b/src/DotRecast.Detour/DtNavMeshQuery.cs index 4a1ce9f..7200a57 100644 --- a/src/DotRecast.Detour/DtNavMeshQuery.cs +++ b/src/DotRecast.Detour/DtNavMeshQuery.cs @@ -607,7 +607,8 @@ namespace DotRecast.Detour { const int batchSize = 32; Span polyRefs = stackalloc long[batchSize]; - DtPoly[] polys = new DtPoly[batchSize]; + using RcRentedArray polysRent = RcRentedArray.Rent(batchSize); + Span polys = polysRent.AsSpan(); int n = 0; if (tile.data.bvTree != null)