diff --git a/Misaki.HighPerformance.Analyzer/Misaki.HighPerformance.Analyzer.Package/Misaki.HighPerformance.Analyzer.Package.csproj b/Misaki.HighPerformance.Analyzer/Misaki.HighPerformance.Analyzer.Package/Misaki.HighPerformance.Analyzer.Package.csproj
index c290a5d..2d8e237 100644
--- a/Misaki.HighPerformance.Analyzer/Misaki.HighPerformance.Analyzer.Package/Misaki.HighPerformance.Analyzer.Package.csproj
+++ b/Misaki.HighPerformance.Analyzer/Misaki.HighPerformance.Analyzer.Package/Misaki.HighPerformance.Analyzer.Package.csproj
@@ -5,7 +5,7 @@
False
True
True
- 1.0.0
+ 1.1.0
diff --git a/Misaki.HighPerformance.LowLevel/Collections/UnsafeArray.cs b/Misaki.HighPerformance.LowLevel/Collections/UnsafeArray.cs
index e4124a6..4e68763 100644
--- a/Misaki.HighPerformance.LowLevel/Collections/UnsafeArray.cs
+++ b/Misaki.HighPerformance.LowLevel/Collections/UnsafeArray.cs
@@ -5,6 +5,7 @@ using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
+using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Misaki.HighPerformance.LowLevel.Collections;
@@ -319,4 +320,14 @@ public unsafe struct UnsafeArray : IUnsafeCollection
_buffer = null;
_count = 0;
}
+
+ public static implicit operator ReadOnlyUnsafeCollection(UnsafeArray array)
+ {
+ return array.AsReadOnly();
+ }
+
+ public static implicit operator Span(UnsafeArray array)
+ {
+ return array.AsSpan();
+ }
}
diff --git a/Misaki.HighPerformance.LowLevel/Collections/UnsafeList.cs b/Misaki.HighPerformance.LowLevel/Collections/UnsafeList.cs
index 69c8ff2..101ae87 100644
--- a/Misaki.HighPerformance.LowLevel/Collections/UnsafeList.cs
+++ b/Misaki.HighPerformance.LowLevel/Collections/UnsafeList.cs
@@ -346,7 +346,7 @@ public unsafe struct UnsafeList : IUnsafeCollection
///
/// Adds a range of elements to the collection.
///
- /// A span containing the elements to add. The span must not exceed the specified .
+ /// A span containing the elements to add.
public void AddRange(Span values)
{
var newSize = _count + values.Length;
@@ -363,6 +363,32 @@ public unsafe struct UnsafeList : IUnsafeCollection
_count += values.Length;
}
+ ///
+ /// Adds a range of elements to the collection.
+ ///
+ /// A collection containing the elements to add.
+ public void AddRange(ReadOnlyUnsafeCollection collection)
+ {
+ AddRange((T*)collection.GetUnsafePtr(), collection.Count);
+ }
+
+ ///
+ /// Adds a range of elements from a pointer to the collection.
+ ///
+ /// Points to the source data to be copied into the collection.
+ /// Indicates the number of elements to be added from the source data.
+ public void AddRange(T* ptr, int count)
+ {
+ var newSize = _count + count;
+ if (newSize > Capacity)
+ {
+ Resize(Capacity + count);
+ }
+
+ MemCpy(UnsafeUtility.ReadArrayElementUnsafe(_array.GetUnsafePtr(), _count), ptr, (uint)(count * sizeof(T)));
+ _count += count;
+ }
+
///
/// Adds the elements of the specified collection to the current list without resizing the underlying storage.
///
@@ -494,4 +520,19 @@ public unsafe struct UnsafeList : IUnsafeCollection
_array.Dispose();
_count = 0;
}
+
+ public static implicit operator UnsafeArray(UnsafeList list)
+ {
+ return list.AsUnsafeArray();
+ }
+
+ public static implicit operator ReadOnlyUnsafeCollection(UnsafeList list)
+ {
+ return list.AsReadOnly();
+ }
+
+ public static implicit operator Span(UnsafeList list)
+ {
+ return list.AsSpan();
+ }
}
diff --git a/Misaki.HighPerformance.LowLevel/MemoryLeakException.cs b/Misaki.HighPerformance.LowLevel/MemoryLeakException.cs
index 5dfd62b..e0f2a71 100644
--- a/Misaki.HighPerformance.LowLevel/MemoryLeakException.cs
+++ b/Misaki.HighPerformance.LowLevel/MemoryLeakException.cs
@@ -48,7 +48,7 @@ public class MemoryLeakException : Exception
var frame = stackTrace.GetFrame(i);
var fileName = frame?.GetFileName();
- if (frame != null && fileName != null)
+ if (frame != null)
{
stringBuilder.AppendLine($"File: {fileName}, Method: {DiagnosticMethodInfo.Create(frame)?.Name}, Line: {frame.GetFileLineNumber()}");
}
diff --git a/Misaki.HighPerformance.LowLevel/Misaki.HighPerformance.LowLevel.csproj b/Misaki.HighPerformance.LowLevel/Misaki.HighPerformance.LowLevel.csproj
index 5375c33..5829706 100644
--- a/Misaki.HighPerformance.LowLevel/Misaki.HighPerformance.LowLevel.csproj
+++ b/Misaki.HighPerformance.LowLevel/Misaki.HighPerformance.LowLevel.csproj
@@ -7,7 +7,7 @@
true
true
Misaki
- 1.5.2
+ 1.5.3
$(AssemblyVersion)
https://git.personalnas.com/Misaki/Misaki.HighPerformance.git
https://git.personalnas.com/Misaki/Misaki.HighPerformance.git
diff --git a/Misaki.HighPerformance/Misaki.HighPerformance.csproj b/Misaki.HighPerformance/Misaki.HighPerformance.csproj
index b1e1940..977088c 100644
--- a/Misaki.HighPerformance/Misaki.HighPerformance.csproj
+++ b/Misaki.HighPerformance/Misaki.HighPerformance.csproj
@@ -7,7 +7,7 @@
True
true
Misaki
- 1.0.4
+ 1.0.5
$(AssemblyVersion)
https://git.personalnas.com/Misaki/Misaki.HighPerformance.git
https://git.personalnas.com/Misaki/Misaki.HighPerformance.git