738 lines
26 KiB
HTML
738 lines
26 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Class UnsafeUtility | Misaki.HighPerformance </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="Class UnsafeUtility | Misaki.HighPerformance ">
|
|
|
|
|
|
<link rel="icon" href="../favicon.ico">
|
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
|
<link rel="stylesheet" href="../public/main.css">
|
|
<meta name="docfx:navrel" content="../toc.html">
|
|
<meta name="docfx:tocrel" content="toc.html">
|
|
|
|
<meta name="docfx:rel" content="../">
|
|
|
|
|
|
|
|
<meta name="loc:inThisArticle" content="In this article">
|
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
|
<meta name="loc:tocFilter" content="Filter by title">
|
|
<meta name="loc:nextArticle" content="Next">
|
|
<meta name="loc:prevArticle" content="Previous">
|
|
<meta name="loc:themeLight" content="Light">
|
|
<meta name="loc:themeDark" content="Dark">
|
|
<meta name="loc:themeAuto" content="Auto">
|
|
<meta name="loc:changeTheme" content="Change theme">
|
|
<meta name="loc:copy" content="Copy">
|
|
<meta name="loc:downloadPdf" content="Download PDF">
|
|
|
|
<script type="module" src="./../public/docfx.min.js"></script>
|
|
|
|
<script>
|
|
const theme = localStorage.getItem('theme') || 'auto'
|
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
|
<header class="bg-body border-bottom">
|
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
|
<div class="container-xxl flex-nowrap">
|
|
<a class="navbar-brand" href="../index.html">
|
|
<img id="logo" class="svg" src="../logo.svg" alt="Misaki.HighPerformance">
|
|
Misaki.HighPerformance
|
|
</a>
|
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
|
<i class="bi bi-three-dots"></i>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navpanel">
|
|
<div id="navbar">
|
|
<form class="search" role="search" id="search">
|
|
<i class="bi bi-search"></i>
|
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="container-xxl">
|
|
<div class="toc-offcanvas">
|
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
|
<div class="offcanvas-header">
|
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
|
</div>
|
|
<div class="offcanvas-body">
|
|
<nav class="toc" id="toc"></nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<div class="actionbar">
|
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
|
<i class="bi bi-list"></i>
|
|
</button>
|
|
|
|
<nav id="breadcrumb"></nav>
|
|
</div>
|
|
|
|
<article data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility">
|
|
|
|
|
|
|
|
<h1 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility" class="text-break">
|
|
Class UnsafeUtility
|
|
</h1>
|
|
|
|
<div class="facts text-secondary">
|
|
<dl><dt>Namespace</dt><dd><a class="xref" href="Misaki.html">Misaki</a>.<a class="xref" href="Misaki.HighPerformance.html">HighPerformance</a>.<a class="xref" href="Misaki.HighPerformance.LowLevel.html">LowLevel</a>.<a class="xref" href="Misaki.HighPerformance.LowLevel.Utilities.html">Utilities</a></dd></dl>
|
|
<dl><dt>Assembly</dt><dd>Misaki.HighPerformance.LowLevel.dll</dd></dl>
|
|
</div>
|
|
|
|
<div class="markdown summary"></div>
|
|
<div class="markdown conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static class UnsafeUtility</code></pre>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<dl class="typelist inheritance">
|
|
<dt>Inheritance</dt>
|
|
<dd>
|
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
|
<div><span class="xref">UnsafeUtility</span></div>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<dl class="typelist inheritedMembers">
|
|
<dt>Inherited Members</dt>
|
|
<dd>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 class="section" id="methods">Methods
|
|
</h2>
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_AddressOf_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.AddressOf*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_AddressOf__1___0__" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.AddressOf``1(``0@)">
|
|
AddressOf<T>(ref T)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Returns the address of a specified variable in memory.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static void* AddressOf<T>(ref T value) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>value</code> <span class="xref">T</span></dt>
|
|
<dd><p>The variable whose memory address is to be obtained.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>A pointer to the memory address of the specified variable.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Represents the type of the variable whose address is being retrieved.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_AsRef_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.AsRef*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_AsRef__1_System_Void__" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.AsRef``1(System.Void*)">
|
|
AsRef<T>(void*)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Converts a pointer to a reference of a specified type.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static ref T AsRef<T>(void* ptr) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Represents the memory address to be converted into a reference.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><span class="xref">T</span></dt>
|
|
<dd><p>Returns a reference of the specified type pointing to the given memory address.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of the reference to be created from the pointer.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_GetUnsafePtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.GetUnsafePtr*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_GetUnsafePtr__1_System_ReadOnlySpan___0__" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.GetUnsafePtr``1(System.ReadOnlySpan{``0})">
|
|
GetUnsafePtr<T>(ReadOnlySpan<T>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Returns a pointer to the first element of the specified span. This method enables direct, unsafe access to the underlying data of the span.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static T* GetUnsafePtr<T>(this ReadOnlySpan<T> span) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>span</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.readonlyspan-1">ReadOnlySpan</a><T></dt>
|
|
<dd><p>The span whose underlying data pointer is to be obtained.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt>T*</dt>
|
|
<dd><p>A pointer to the first element of the span. If the span is empty, the returned pointer is undefined and must not be dereferenced.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>The type of elements in the span. Must be an unmanaged type.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_GetUnsafePtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.GetUnsafePtr*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_GetUnsafePtr__1_System_Span___0__" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.GetUnsafePtr``1(System.Span{``0})">
|
|
GetUnsafePtr<T>(Span<T>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Returns a pointer to the first element of the specified span. This method enables direct, unsafe access to the underlying data of the span.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static T* GetUnsafePtr<T>(this Span<T> span) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>span</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.span-1">Span</a><T></dt>
|
|
<dd><p>The span whose underlying data pointer is to be obtained.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt>T*</dt>
|
|
<dd><p>A pointer to the first element of the span. If the span is empty, the returned pointer is undefined and must not be dereferenced.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>The type of elements in the span. Must be an unmanaged type.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementRef_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementRef*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementRef__1_System_Void__System_IntPtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementRef``1(System.Void*,System.IntPtr)">
|
|
ReadArrayElementRef<T>(void*, nint)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Reads an element from an unmanaged array using a pointer and index, returning a reference to the element.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static ref T ReadArrayElementRef<T>(void* ptr, nint index) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the start of the unmanaged array from which the element is read.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">nint</a></dt>
|
|
<dd><p>Indicates the position of the element to be accessed in the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><span class="xref">T</span></dt>
|
|
<dd><p>A reference to the specified element in the unmanaged array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of the elements in the unmanaged array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementRef_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementRef*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementRef__1_System_Void__System_UIntPtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementRef``1(System.Void*,System.UIntPtr)">
|
|
ReadArrayElementRef<T>(void*, nuint)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Reads an element from an unmanaged array using a pointer and index, returning a reference to the element.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static ref T ReadArrayElementRef<T>(void* ptr, nuint index) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the start of the unmanaged array from which the element is read.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.uintptr">nuint</a></dt>
|
|
<dd><p>Indicates the position of the element to be accessed in the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><span class="xref">T</span></dt>
|
|
<dd><p>A reference to the specified element in the unmanaged array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of the elements in the unmanaged array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementUnsafe_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementUnsafe*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementUnsafe__1_System_Void__System_IntPtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementUnsafe``1(System.Void*,System.IntPtr)">
|
|
ReadArrayElementUnsafe<T>(void*, nint)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Reads an element from an unmanaged array at a specified index using a pointer.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static T* ReadArrayElementUnsafe<T>(void* ptr, nint index) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the start of the unmanaged array from which the element is read.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">nint</a></dt>
|
|
<dd><p>Indicates the position of the element to be accessed within the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt>T*</dt>
|
|
<dd><p>Returns a pointer to the element located at the specified index.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of elements in the unmanaged array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementUnsafe_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementUnsafe*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElementUnsafe__1_System_Void__System_UIntPtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElementUnsafe``1(System.Void*,System.UIntPtr)">
|
|
ReadArrayElementUnsafe<T>(void*, nuint)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Reads an element from an unmanaged array at a specified index using a pointer.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static T* ReadArrayElementUnsafe<T>(void* ptr, nuint index) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the start of the unmanaged array from which the element is read.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.uintptr">nuint</a></dt>
|
|
<dd><p>Indicates the position of the element to be accessed within the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt>T*</dt>
|
|
<dd><p>Returns a pointer to the element located at the specified index.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of elements in the unmanaged array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElement_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElement*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElement__1_System_Void__System_IntPtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElement``1(System.Void*,System.IntPtr)">
|
|
ReadArrayElement<T>(void*, nint)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Reads an element from an array at a specified index using a pointer to the array.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static T ReadArrayElement<T>(void* ptr, nint index) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the start of the array from which an element will be read.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">nint</a></dt>
|
|
<dd><p>Indicates the position of the element to be accessed within the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><span class="xref">T</span></dt>
|
|
<dd><p>The element located at the specified index in the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of the elements in the array, which must be unmanaged.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElement_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElement*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_ReadArrayElement__1_System_Void__System_UIntPtr_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.ReadArrayElement``1(System.Void*,System.UIntPtr)">
|
|
ReadArrayElement<T>(void*, nuint)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Reads an element from an array at a specified index using a pointer to the array.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static T ReadArrayElement<T>(void* ptr, nuint index) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the start of the array from which an element will be read.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.uintptr">nuint</a></dt>
|
|
<dd><p>Indicates the position of the element to be accessed within the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><span class="xref">T</span></dt>
|
|
<dd><p>The element located at the specified index in the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of the elements in the array, which must be unmanaged.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_WriteArrayElement_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.WriteArrayElement*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_WriteArrayElement__1_System_Void__System_IntPtr___0_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.WriteArrayElement``1(System.Void*,System.IntPtr,``0)">
|
|
WriteArrayElement<T>(void*, nint, T)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Writes a value to a specified index of an unmanaged array using a pointer.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static void WriteArrayElement<T>(void* ptr, nint index, T value) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the beginning of the unmanaged array where the value will be written.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">nint</a></dt>
|
|
<dd><p>Indicates the position in the array where the value should be stored.</p>
|
|
</dd>
|
|
<dt><code>value</code> <span class="xref">T</span></dt>
|
|
<dd><p>Represents the value to be written to the specified index of the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of the value being written to the array, which must be an unmanaged type.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_WriteArrayElement_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.WriteArrayElement*"></a>
|
|
|
|
<h3 id="Misaki_HighPerformance_LowLevel_Utilities_UnsafeUtility_WriteArrayElement__1_System_Void__System_UIntPtr___0_" data-uid="Misaki.HighPerformance.LowLevel.Utilities.UnsafeUtility.WriteArrayElement``1(System.Void*,System.UIntPtr,``0)">
|
|
WriteArrayElement<T>(void*, nuint, T)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Writes a value to a specified index of an unmanaged array using a pointer.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static void WriteArrayElement<T>(void* ptr, nuint index, T value) where T : unmanaged</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>ptr</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.void">void</a>*</dt>
|
|
<dd><p>Points to the beginning of the unmanaged array where the value will be written.</p>
|
|
</dd>
|
|
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.uintptr">nuint</a></dt>
|
|
<dd><p>Indicates the position in the array where the value should be stored.</p>
|
|
</dd>
|
|
<dt><code>value</code> <span class="xref">T</span></dt>
|
|
<dd><p>Represents the value to be written to the specified index of the array.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Specifies the type of the value being written to the array, which must be an unmanaged type.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</article>
|
|
|
|
<div class="contribution d-print-none">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="affix">
|
|
<nav id="affix"></nav>
|
|
</div>
|
|
</main>
|
|
|
|
<div class="container-xxl search-results" id="search-results"></div>
|
|
|
|
<footer class="border-top text-secondary">
|
|
<div class="container-xxl">
|
|
<div class="flex-fill">
|
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|