Skip to content

Commit

Permalink
Maek readonly array as readonly memory
Browse files Browse the repository at this point in the history
  • Loading branch information
hadashiA committed May 22, 2024
1 parent 612169d commit 46a6545
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Assets/Unio/NativeArrayBufferWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class NativeArrayBufferWriter<T> : IBufferWriter<T>, IDisposable where T
public int Capacity => buffer.Length;
public int FreeCapacity => buffer.Length - offset;

NativeArrayMemoryManager<T> memoryManager;
readonly NativeArrayMemoryManager<T> memoryManager;

public unsafe NativeArray<T> WrittenBuffer
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/Unio/NativeArrayMemoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static unsafe Memory<T> AsMemory<T>(this NativeArray<T> nativeArray) wher
return new NativeArrayMemoryManager<T>((T*)nativeArray.GetUnsafeReadOnlyPtr(), nativeArray.Length).Memory;
}

public static unsafe Memory<T> AsMemory<T>(this NativeArray<T>.ReadOnly nativeArray) where T : unmanaged
public static unsafe ReadOnlyMemory<T> AsMemory<T>(this NativeArray<T>.ReadOnly nativeArray) where T : unmanaged
{
return new NativeArrayMemoryManager<T>((T*)nativeArray.GetUnsafeReadOnlyPtr(), nativeArray.Length).Memory;
}
Expand Down

0 comments on commit 46a6545

Please sign in to comment.