forked from mirror/DotRecast
Added RcSpans.Fill<T>()
This commit is contained in:
parent
bdb9463d88
commit
d472d71795
|
@ -26,5 +26,11 @@ namespace DotRecast.Core
|
|||
var slicedDst = src.Slice(dstIdx, length);
|
||||
slicedSrc.CopyTo(slicedDst);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Fill<T>(Span<T> span, T value, int start, int count)
|
||||
{
|
||||
span.Slice(start, count).Fill(value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,14 +52,14 @@ namespace DotRecast.Detour.TileCache
|
|||
}
|
||||
|
||||
// Partition walkable area into monotone regions.
|
||||
int[] prevCount = new int[256];
|
||||
Span<byte> prevCount = stackalloc byte[256];
|
||||
byte regId = 0;
|
||||
|
||||
for (int y = 0; y < h; ++y)
|
||||
{
|
||||
if (regId > 0)
|
||||
{
|
||||
Array.Fill(prevCount, 0, 0, regId);
|
||||
RcSpans.Fill<byte>(prevCount, 0, 0, regId);
|
||||
}
|
||||
|
||||
// Memset(prevCount,0,Sizeof(char)*regId);
|
||||
|
@ -225,7 +225,7 @@ namespace DotRecast.Detour.TileCache
|
|||
}
|
||||
|
||||
// Compact ids.
|
||||
byte[] remap = new byte[256];
|
||||
Span<byte> remap = stackalloc byte[256];
|
||||
// Find number of unique regions.
|
||||
regId = 0;
|
||||
for (int i = 0; i < nregs; ++i)
|
||||
|
|
Loading…
Reference in New Issue