forked from mirror/DotRecast
Span access
This commit is contained in:
parent
c8104cec4d
commit
6fe6844efd
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
@ -43,6 +43,11 @@ namespace DotRecast.Core.Buffers
|
||||||
return _array;
|
return _array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Span<T> AsSpan()
|
||||||
|
{
|
||||||
|
return new Span<T>(_array, 0, Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|
|
@ -599,7 +599,7 @@ namespace DotRecast.Detour
|
||||||
const int batchSize = 32;
|
const int batchSize = 32;
|
||||||
Span<long> polyRefs = stackalloc long[batchSize];
|
Span<long> polyRefs = stackalloc long[batchSize];
|
||||||
using RcRentedArray<DtPoly> polysRent = RcRentedArray.Rent<DtPoly>(batchSize);
|
using RcRentedArray<DtPoly> polysRent = RcRentedArray.Rent<DtPoly>(batchSize);
|
||||||
Span<DtPoly> polys = new Span<DtPoly>(polysRent.AsArray(), 0, batchSize);
|
Span<DtPoly> polys = polysRent.AsSpan();
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
if (tile.data.bvTree != null)
|
if (tile.data.bvTree != null)
|
||||||
|
|
Loading…
Reference in New Issue