This commit is contained in:
DCFApixels 2025-05-22 15:25:38 +08:00
parent 2771d628d6
commit 601cb6b4d8
2 changed files with 14 additions and 1 deletions

View File

@ -89,7 +89,12 @@ namespace DCFApixels.DragonECS
#else #else
false; false;
#endif #endif
public const bool ENABLE_DUMMY_SPAN =
#if ENABLE_DUMMY_SPAN
true;
#else
false;
#endif
[Obsolete("DRAGONECS_ENABLE_DEBUG_SERVICE")] [Obsolete("DRAGONECS_ENABLE_DEBUG_SERVICE")]

View File

@ -10,8 +10,16 @@ namespace DCFApixels.DragonECS.Core.Internal
} }
public static unsafe void ClearAllocatedMemory(byte* ptr, int startByte, int lengthInBytes) public static unsafe void ClearAllocatedMemory(byte* ptr, int startByte, int lengthInBytes)
{ {
#if ENABLE_DUMMY_SPAN
lengthInBytes += startByte;
for (int i = startByte; i < lengthInBytes; i++)
{
ptr[i] = 0;
}
#else
Span<byte> memorySpan = new Span<byte>(ptr + startByte, lengthInBytes); Span<byte> memorySpan = new Span<byte>(ptr + startByte, lengthInBytes);
memorySpan.Clear(); memorySpan.Clear();
#endif
} }
} }
} }