2343 references to MemoryMarshal
Aspire.Dashboard.Tests (1)
TelemetryRepositoryTests\MetricsTests.cs (1)
623Assert.True(Enumerable.SequenceEqual(MemoryMarshal.ToEnumerable(key), scope.Attributes), "Key and attributes don't match.");
ClientSample (2)
Tcp\BufferExtensions.cs (1)
20if (!MemoryMarshal.TryGetArray(memory, out var result))
Tcp\SocketSender.cs (1)
66_eventArgs.SetBuffer(MemoryMarshal.AsMemory(memory));
http2cat (2)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.FunctionalTests (2)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.LongTests (2)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.NewHandler.FunctionalTests (2)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.NewShim.FunctionalTests (2)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.ShadowCopy.Tests (2)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IISExpress.FunctionalTests (2)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
illink (2)
InMemory.FunctionalTests (4)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\EndpointHtmlRenderer.Streaming.cs (1)
130? MemoryMarshal.Cast<byte, ComponentIdAndDepth>(stackalloc byte[bufSizeRequired])
Microsoft.AspNetCore.Components.Server (6)
Circuits\CircuitId.cs (2)
42MemoryMarshal.AsBytes(Secret.AsSpan()), 43MemoryMarshal.AsBytes(other.Secret.AsSpan()));
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (2)
65MemoryMarshal.TryGetArray(memory, out _segment); 220MemoryMarshal.TryGetArray(memory, out _segment);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReaderExtensions.cs (2)
40value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(span)); 84value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(tempSpan));
Microsoft.AspNetCore.Http (2)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (2)
548ref var r = ref MemoryMarshal.GetArrayDataReference(_arrayStorage); 549return MemoryMarshal.CreateSpan(ref r, _count);
Microsoft.AspNetCore.Http.Extensions (2)
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (2)
65return ref MemoryMarshal.GetReference(_chars); 79return ref MemoryMarshal.GetReference(_chars);
Microsoft.AspNetCore.HttpLogging (2)
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (2)
65return ref MemoryMarshal.GetReference(_chars); 79return ref MemoryMarshal.GetReference(_chars);
Microsoft.AspNetCore.OutputCaching (6)
FormatterBinaryReader.cs (3)
31_root = ref MemoryMarshal.GetReference(content.Span); 143var s = Encoding.UTF8.GetString(MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref _root, _offset), bytes)); 170var result = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref _root, _offset), count);
FormatterBinaryWriter.cs (2)
39return MemoryMarshal.CreateSpan(ref Unsafe.Add(ref root, offset), length - offset); 117root = ref MemoryMarshal.GetReference(span);
RecyclableSequenceBuilder.cs (1)
85return MemoryMarshal.AsMemory(current).Span.Slice(_currentSegmentIndex);
Microsoft.AspNetCore.Routing (4)
Matching\ILEmitTrieFactory.cs (4)
546ref var p = ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(span)); 700GetReference = typeof(MemoryMarshal).GetMethod( 701nameof(MemoryMarshal.GetReference), 755/// <see cref="MemoryMarshal.GetReference{T}(ReadOnlySpan{T})"/> - GetReference[char]
Microsoft.AspNetCore.Server.HttpSys (11)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (3)
105var timingCount = MemoryMarshal.Read<int>(timingInfo.Span); 109return MemoryMarshal.CreateReadOnlySpan( 110ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\PathNormalizer\PathNormalizer.cs (3)
59else if (MemoryMarshal.CreateSpan(ref src[nextIndex], 2).StartsWith(dotSlash)) 63var lastIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash); 93var lastSlashIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash);
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
Microsoft.AspNetCore.Server.HttpSys.Microbenchmarks (6)
RequestHeaderBenchmarks.cs (6)
62MemoryMarshal.Write(nativeMemory, in requestStructure); 74fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 88fixed (byte* address = &MemoryMarshal.GetReference(unknownHeaderStructureDestination)) 100fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 110fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 117MemoryMarshal.Write(unknownHeaderStructureDestination, in unknownHeaderStructure);
Microsoft.AspNetCore.Server.HttpSys.Tests (26)
RequestHeaderTests.cs (26)
27MemoryMarshal.Write(nativeMemory, in requestStructure); 48MemoryMarshal.Write(nativeMemory, in requestStructure); 68MemoryMarshal.Write(nativeMemory, in requestStructure); 89MemoryMarshal.Write(nativeMemory, in requestStructure); 109MemoryMarshal.Write(nativeMemory, in requestStructure); 128MemoryMarshal.Write(nativeMemory, in requestStructure); 148MemoryMarshal.Write(nativeMemory, in requestStructure); 172MemoryMarshal.Write(nativeMemory, in requestStructure); 194MemoryMarshal.Write(nativeMemory, in requestStructure); 216MemoryMarshal.Write(nativeMemory, in requestStructure); 238MemoryMarshal.Write(nativeMemory, in requestStructure); 259MemoryMarshal.Write(nativeMemory, in requestStructure); 279MemoryMarshal.Write(nativeMemory, in requestStructure); 301MemoryMarshal.Write(nativeMemory, in requestStructure); 323MemoryMarshal.Write(nativeMemory, in requestStructure); 344MemoryMarshal.Write(nativeMemory, in requestStructure); 361fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 370fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 385fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 403fixed (byte* address = &MemoryMarshal.GetReference(unknownHeaderStructureDestination)) 415fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 425fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 432MemoryMarshal.Write(unknownHeaderStructureDestination, in unknownHeaderStructure); 441fixed (byte* address = &MemoryMarshal.GetReference(unknownHeaderStructureDestination)) 455fixed (byte* address = &MemoryMarshal.GetReference(dataDestination)) 464MemoryMarshal.Write(unknownHeaderStructureDestination, in unknownHeaderStructure);
Microsoft.AspNetCore.Server.IIS (12)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (3)
105var timingCount = MemoryMarshal.Read<int>(timingInfo.Span); 109return MemoryMarshal.CreateReadOnlySpan( 110ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\PathNormalizer\PathNormalizer.cs (3)
59else if (MemoryMarshal.CreateSpan(ref src[nextIndex], 2).StartsWith(dotSlash)) 63var lastIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash); 93var lastSlashIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash);
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.Kestrel.Core (16)
Internal\Http\HttpHeaders.cs (7)
381var byteValue = MemoryMarshal.AsBytes(value); 501ulong result = MemoryMarshal.Read<ulong>(value); 515uint result = MemoryMarshal.Read<uint>(value); 526=> (ushort)(MemoryMarshal.Read<ushort>(value) | 0x0020); 568var byteValue = MemoryMarshal.AsBytes(values); 644if (MemoryMarshal.TryRead(byteValue, out ulong result)) 664if (MemoryMarshal.TryRead(byteValue, out uint result))
Internal\Http\HttpHeaders.Generated.cs (1)
7516ref byte nameStart = ref MemoryMarshal.GetReference(name);
Internal\Http\HttpParser.cs (2)
186var startLine = MemoryMarshal.CreateSpan(ref MemoryMarshal.GetReference(requestLine), queryEnd);
Internal\Infrastructure\HttpUtilities.cs (1)
328var c = MemoryMarshal.GetReference(str);
src\Shared\PathNormalizer\PathNormalizer.cs (3)
59else if (MemoryMarshal.CreateSpan(ref src[nextIndex], 2).StartsWith(dotSlash)) 63var lastIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash); 93var lastSlashIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash);
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (6)
DiagnosticMemoryPoolTests.cs (2)
104var exception = Assert.Throws<InvalidOperationException>(() => MemoryMarshal.TryGetArray<byte>(memory, out _)); 170var exception = Assert.Throws<ObjectDisposedException>(() => MemoryMarshal.TryGetArray<byte>(memory, out _));
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (4)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (4)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (5)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (6)
Internal\BufferExtensions.cs (1)
17if (!MemoryMarshal.TryGetArray(memory, out var result))
Internal\SocketSender.cs (1)
61SetBuffer(MemoryMarshal.AsMemory(memory));
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
179return MemoryMarshal.TryGetArray(_memory, out segment);
src\Shared\Buffers.MemoryPool\MemoryPoolBlock.cs (1)
19Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (2)
59return (T*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(alloc)); 101return (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
Microsoft.AspNetCore.Shared.Tests (10)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (2)
548ref var r = ref MemoryMarshal.GetArrayDataReference(_arrayStorage); 549return MemoryMarshal.CreateSpan(ref r, _count);
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (3)
105var timingCount = MemoryMarshal.Read<int>(timingInfo.Span); 109return MemoryMarshal.CreateReadOnlySpan( 110ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\PathNormalizer\PathNormalizer.cs (3)
59else if (MemoryMarshal.CreateSpan(ref src[nextIndex], 2).StartsWith(dotSlash)) 63var lastIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash); 93var lastSlashIndex = MemoryMarshal.CreateSpan(ref src[0], writtenLength).LastIndexOf(ByteSlash);
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
59if (!MemoryMarshal.TryGetArray(memory, out var result))
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
172ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
Internal\RedisProtocol.cs (1)
243var isArray = MemoryMarshal.TryGetArray(serializedMessage.Serialized, out var array);
Microsoft.AspNetCore.WebSockets (2)
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (2)
65return ref MemoryMarshal.GetReference(_chars); 79return ref MemoryMarshal.GetReference(_chars);
Microsoft.AspNetCore.WebUtilities (2)
FormPipeReader.cs (2)
398var span = MemoryMarshal.CreateSpan(ref MemoryMarshal.GetReference(readOnlySpan), readOnlySpan.Length);
Microsoft.Build.Framework (4)
ArraySortHelper.cs (1)
1300ref MemoryMarshal.GetReference(Log2DeBruijn),
SegmentedArray.cs (3)
61if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 156if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 223if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis (12)
Hashing\XxHash128.cs (3)
136fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 229ref byte dest0 = ref MemoryMarshal.GetReference(destination); 397fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
Hashing\XxHashShared.cs (4)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3)); 267fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 489fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
src\Dependencies\Collections\SegmentedArray.cs (3)
67if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 162if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 229if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Text\SourceText.cs (2)
651var shortSpan = MemoryMarshal.Cast<char, short>(charSpan); 664hash.Append(MemoryMarshal.AsBytes(charSpan));
Microsoft.CodeAnalysis.CodeStyle (13)
src\Compilers\Core\Portable\Hashing\XxHash128.cs (3)
136fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 229ref byte dest0 = ref MemoryMarshal.GetReference(destination); 397fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (4)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3)); 267fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 489fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
src\Dependencies\Collections\SegmentedArray.cs (3)
67if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 162if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 229if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (3)
196ref char srcChars = ref MemoryMarshal.GetReference(utf16); 197ref byte destBytes = ref MemoryMarshal.GetReference(bytes); 208ref sbyte decodingMap = ref MemoryMarshal.GetReference(DecodingMap);
Microsoft.CodeAnalysis.Collections.Package (3)
SegmentedArray.cs (3)
67if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 162if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 229if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.UnitTests (1)
CommonCommandLineParserTests.cs (1)
1265Assert.True(MemoryMarshal.TryGetString(memory, out var memoryString, out _, out _));
Microsoft.CodeAnalysis.Workspaces (21)
src\Compilers\Core\Portable\Hashing\XxHash128.cs (3)
136fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 229ref byte dest0 = ref MemoryMarshal.GetReference(destination); 397fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (4)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3)); 267fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 489fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
src\Dependencies\Collections\SegmentedArray.cs (3)
67if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 162if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 229if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (3)
196ref char srcChars = ref MemoryMarshal.GetReference(utf16); 197ref byte destBytes = ref MemoryMarshal.GetReference(bytes); 208ref sbyte decodingMap = ref MemoryMarshal.GetReference(DecodingMap);
Storage\SQLite\v2\Interop\SqlConnection.cs (1)
316Contract.ThrowIfFalse(MemoryMarshal.TryRead(bytes, out Checksum result));
Workspace\Solution\Checksum.cs (2)
57Contract.ThrowIfFalse(MemoryMarshal.TryRead(checksum, out Checksum result)); 89Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(span), this);
Workspace\Solution\Checksum_Factory.cs (5)
32pooledHash.Object.Append(MemoryMarshal.AsBytes(value.AsSpan())); 33pooledHash.Object.Append(MemoryMarshal.AsBytes("\0".AsSpan())); 44XxHash128.Hash(MemoryMarshal.AsBytes(value.AsSpan()), destination); 83XxHash128.Hash(MemoryMarshal.AsBytes(hashes), destination); 115pooledHash.Object.Append(MemoryMarshal.AsBytes(hashSpan));
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
src\Dependencies\Collections\SegmentedArray.cs (3)
67if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 162if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 229if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.Data.Analysis (140)
Computations\Arithmetic.netstandard.cs (132)
167ref byte xRef = ref MemoryMarshal.GetReference(x); 168ref byte yRef = ref MemoryMarshal.GetReference(y); 169ref byte dRef = ref MemoryMarshal.GetReference(destination); 221ref byte xRef = ref MemoryMarshal.GetReference(x); 222ref byte yRef = ref MemoryMarshal.GetReference(y); 223ref byte dRef = ref MemoryMarshal.GetReference(destination); 275ref byte xRef = ref MemoryMarshal.GetReference(x); 276ref byte yRef = ref MemoryMarshal.GetReference(y); 277ref byte dRef = ref MemoryMarshal.GetReference(destination); 334ref byte xRef = ref MemoryMarshal.GetReference(x); 335ref byte yRef = ref MemoryMarshal.GetReference(y); 336ref byte dRef = ref MemoryMarshal.GetReference(destination); 636ref char xRef = ref MemoryMarshal.GetReference(x); 637ref char yRef = ref MemoryMarshal.GetReference(y); 638ref char dRef = ref MemoryMarshal.GetReference(destination); 690ref char xRef = ref MemoryMarshal.GetReference(x); 691ref char yRef = ref MemoryMarshal.GetReference(y); 692ref char dRef = ref MemoryMarshal.GetReference(destination); 744ref char xRef = ref MemoryMarshal.GetReference(x); 745ref char yRef = ref MemoryMarshal.GetReference(y); 746ref char dRef = ref MemoryMarshal.GetReference(destination); 803ref char xRef = ref MemoryMarshal.GetReference(x); 804ref char yRef = ref MemoryMarshal.GetReference(y); 805ref char dRef = ref MemoryMarshal.GetReference(destination); 1379ref double xRef = ref MemoryMarshal.GetReference(x); 1380ref double yRef = ref MemoryMarshal.GetReference(y); 1381ref double dRef = ref MemoryMarshal.GetReference(destination); 1433ref double xRef = ref MemoryMarshal.GetReference(x); 1434ref double yRef = ref MemoryMarshal.GetReference(y); 1435ref double dRef = ref MemoryMarshal.GetReference(destination); 1487ref double xRef = ref MemoryMarshal.GetReference(x); 1488ref double yRef = ref MemoryMarshal.GetReference(y); 1489ref double dRef = ref MemoryMarshal.GetReference(destination); 1546ref double xRef = ref MemoryMarshal.GetReference(x); 1547ref double yRef = ref MemoryMarshal.GetReference(y); 1548ref double dRef = ref MemoryMarshal.GetReference(destination); 1737ref float xRef = ref MemoryMarshal.GetReference(x); 1738ref float yRef = ref MemoryMarshal.GetReference(y); 1739ref float dRef = ref MemoryMarshal.GetReference(destination); 1791ref float xRef = ref MemoryMarshal.GetReference(x); 1792ref float yRef = ref MemoryMarshal.GetReference(y); 1793ref float dRef = ref MemoryMarshal.GetReference(destination); 1845ref float xRef = ref MemoryMarshal.GetReference(x); 1846ref float yRef = ref MemoryMarshal.GetReference(y); 1847ref float dRef = ref MemoryMarshal.GetReference(destination); 1904ref float xRef = ref MemoryMarshal.GetReference(x); 1905ref float yRef = ref MemoryMarshal.GetReference(y); 1906ref float dRef = ref MemoryMarshal.GetReference(destination); 2095ref int xRef = ref MemoryMarshal.GetReference(x); 2096ref int yRef = ref MemoryMarshal.GetReference(y); 2097ref int dRef = ref MemoryMarshal.GetReference(destination); 2149ref int xRef = ref MemoryMarshal.GetReference(x); 2150ref int yRef = ref MemoryMarshal.GetReference(y); 2151ref int dRef = ref MemoryMarshal.GetReference(destination); 2203ref int xRef = ref MemoryMarshal.GetReference(x); 2204ref int yRef = ref MemoryMarshal.GetReference(y); 2205ref int dRef = ref MemoryMarshal.GetReference(destination); 2262ref int xRef = ref MemoryMarshal.GetReference(x); 2263ref int yRef = ref MemoryMarshal.GetReference(y); 2264ref int dRef = ref MemoryMarshal.GetReference(destination); 2564ref long xRef = ref MemoryMarshal.GetReference(x); 2565ref long yRef = ref MemoryMarshal.GetReference(y); 2566ref long dRef = ref MemoryMarshal.GetReference(destination); 2618ref long xRef = ref MemoryMarshal.GetReference(x); 2619ref long yRef = ref MemoryMarshal.GetReference(y); 2620ref long dRef = ref MemoryMarshal.GetReference(destination); 2672ref long xRef = ref MemoryMarshal.GetReference(x); 2673ref long yRef = ref MemoryMarshal.GetReference(y); 2674ref long dRef = ref MemoryMarshal.GetReference(destination); 2731ref long xRef = ref MemoryMarshal.GetReference(x); 2732ref long yRef = ref MemoryMarshal.GetReference(y); 2733ref long dRef = ref MemoryMarshal.GetReference(destination); 3033ref sbyte xRef = ref MemoryMarshal.GetReference(x); 3034ref sbyte yRef = ref MemoryMarshal.GetReference(y); 3035ref sbyte dRef = ref MemoryMarshal.GetReference(destination); 3087ref sbyte xRef = ref MemoryMarshal.GetReference(x); 3088ref sbyte yRef = ref MemoryMarshal.GetReference(y); 3089ref sbyte dRef = ref MemoryMarshal.GetReference(destination); 3141ref sbyte xRef = ref MemoryMarshal.GetReference(x); 3142ref sbyte yRef = ref MemoryMarshal.GetReference(y); 3143ref sbyte dRef = ref MemoryMarshal.GetReference(destination); 3200ref sbyte xRef = ref MemoryMarshal.GetReference(x); 3201ref sbyte yRef = ref MemoryMarshal.GetReference(y); 3202ref sbyte dRef = ref MemoryMarshal.GetReference(destination); 3502ref short xRef = ref MemoryMarshal.GetReference(x); 3503ref short yRef = ref MemoryMarshal.GetReference(y); 3504ref short dRef = ref MemoryMarshal.GetReference(destination); 3556ref short xRef = ref MemoryMarshal.GetReference(x); 3557ref short yRef = ref MemoryMarshal.GetReference(y); 3558ref short dRef = ref MemoryMarshal.GetReference(destination); 3610ref short xRef = ref MemoryMarshal.GetReference(x); 3611ref short yRef = ref MemoryMarshal.GetReference(y); 3612ref short dRef = ref MemoryMarshal.GetReference(destination); 3669ref short xRef = ref MemoryMarshal.GetReference(x); 3670ref short yRef = ref MemoryMarshal.GetReference(y); 3671ref short dRef = ref MemoryMarshal.GetReference(destination); 3971ref uint xRef = ref MemoryMarshal.GetReference(x); 3972ref uint yRef = ref MemoryMarshal.GetReference(y); 3973ref uint dRef = ref MemoryMarshal.GetReference(destination); 4025ref uint xRef = ref MemoryMarshal.GetReference(x); 4026ref uint yRef = ref MemoryMarshal.GetReference(y); 4027ref uint dRef = ref MemoryMarshal.GetReference(destination); 4079ref uint xRef = ref MemoryMarshal.GetReference(x); 4080ref uint yRef = ref MemoryMarshal.GetReference(y); 4081ref uint dRef = ref MemoryMarshal.GetReference(destination); 4138ref uint xRef = ref MemoryMarshal.GetReference(x); 4139ref uint yRef = ref MemoryMarshal.GetReference(y); 4140ref uint dRef = ref MemoryMarshal.GetReference(destination); 4440ref ulong xRef = ref MemoryMarshal.GetReference(x); 4441ref ulong yRef = ref MemoryMarshal.GetReference(y); 4442ref ulong dRef = ref MemoryMarshal.GetReference(destination); 4494ref ulong xRef = ref MemoryMarshal.GetReference(x); 4495ref ulong yRef = ref MemoryMarshal.GetReference(y); 4496ref ulong dRef = ref MemoryMarshal.GetReference(destination); 4548ref ulong xRef = ref MemoryMarshal.GetReference(x); 4549ref ulong yRef = ref MemoryMarshal.GetReference(y); 4550ref ulong dRef = ref MemoryMarshal.GetReference(destination); 4607ref ulong xRef = ref MemoryMarshal.GetReference(x); 4608ref ulong yRef = ref MemoryMarshal.GetReference(y); 4609ref ulong dRef = ref MemoryMarshal.GetReference(destination); 4909ref ushort xRef = ref MemoryMarshal.GetReference(x); 4910ref ushort yRef = ref MemoryMarshal.GetReference(y); 4911ref ushort dRef = ref MemoryMarshal.GetReference(destination); 4963ref ushort xRef = ref MemoryMarshal.GetReference(x); 4964ref ushort yRef = ref MemoryMarshal.GetReference(y); 4965ref ushort dRef = ref MemoryMarshal.GetReference(destination); 5017ref ushort xRef = ref MemoryMarshal.GetReference(x); 5018ref ushort yRef = ref MemoryMarshal.GetReference(y); 5019ref ushort dRef = ref MemoryMarshal.GetReference(destination); 5076ref ushort xRef = ref MemoryMarshal.GetReference(x); 5077ref ushort yRef = ref MemoryMarshal.GetReference(y); 5078ref ushort dRef = ref MemoryMarshal.GetReference(destination);
DataFrameBuffer.cs (2)
32get => (MemoryMarshal.Cast<byte, T>(Buffer.Span)).Slice(0, Length); 38get => MemoryMarshal.Cast<byte, T>(Buffer.Span);
DataFrameColumns\ArrowStringDataFrameColumn.cs (1)
261fixed (byte* data = &MemoryMarshal.GetReference(bytes))
PrimitiveColumnContainer.cs (2)
488mapIndicesLongSpan = MemoryMarshal.Cast<U, long>(mapIndicesSpan); 492mapIndicesIntSpan = MemoryMarshal.Cast<U, int>(mapIndicesSpan);
PrimitiveDataFrameColumn.cs (1)
150ReadOnlySpan<DateTime> valueSpan = MemoryMarshal.Cast<T, DateTime>(valueBuffer.ReadOnlySpan);
PrimitiveDataFrameColumn.Sort.cs (1)
66bool isArray = MemoryMarshal.TryGetArray(typedBuffer, out ArraySegment<T> arraySegment);
ReadOnlyDataFrameBuffer.cs (1)
44get => (MemoryMarshal.Cast<byte, T>(ReadOnlyBuffer.Span)).Slice(0, Length);
Microsoft.Extensions.AI.Abstractions.Tests (1)
Embeddings\EmbeddingTests.cs (1)
34Assert.True(MemoryMarshal.TryGetArray(e.Vector, out ArraySegment<float> array));
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceEmbeddingGenerator.cs (2)
133bytes.AsSpan(0, bytesWritten).CopyTo(MemoryMarshal.AsBytes(vector.AsSpan())); 136Span<int> ints = MemoryMarshal.Cast<float, int>(vector.AsSpan());
Microsoft.Extensions.Caching.Hybrid.Tests (4)
DistributedCacheTests.cs (4)
325Assert.True(MemoryMarshal.TryGetArray(payload.First, out _)); 332Assert.False(MemoryMarshal.TryGetArray(payload.First, out _)); 336Assert.True(MemoryMarshal.TryGetArray(payload.First, out var segment)); 344Assert.True(MemoryMarshal.TryGetArray(payload.First, out segment));
Microsoft.Extensions.Caching.SqlServer (2)
DatabaseOperations.cs (1)
325if (MemoryMarshal.TryGetArray<byte>(memory, out var segment))
SqlServerCache.cs (1)
244if (value.IsSingleSegment && MemoryMarshal.TryGetArray(value.First, out var segment))
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Linux\OSFileSystem.cs (1)
97if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> arraySegment) && arraySegment.Array != null)
Microsoft.Extensions.Identity.Core (1)
UserManager.cs (1)
2085RandomNumberGenerator.Fill(MemoryMarshal.AsBytes(resultBuffer));
Microsoft.Extensions.Logging.Abstractions (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
Microsoft.Extensions.Logging.Console (1)
JsonConsoleFormatter.cs (1)
182writer.WriteString(key, MemoryMarshal.CreateSpan(ref charValue, 1));
Microsoft.ML.Core (1)
Data\ReadOnlyMemoryUtils.cs (1)
250fixed (char* valueChars = &MemoryMarshal.GetReference(span))
Microsoft.ML.CpuMath (84)
AvxIntrinsics.cs (42)
422fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 465fixed (float* pd = &MemoryMarshal.GetReference(dst)) 572fixed (float* psrc = &MemoryMarshal.GetReference(src)) 573fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 619fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 667fixed (float* psrc = &MemoryMarshal.GetReference(src)) 668fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 722fixed (float* psrc = &MemoryMarshal.GetReference(src)) 723fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 724fixed (float* pres = &MemoryMarshal.GetReference(result)) 779fixed (float* psrc = &MemoryMarshal.GetReference(src)) 780fixed (int* pidx = &MemoryMarshal.GetReference(idx)) 781fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 829fixed (float* psrc = &MemoryMarshal.GetReference(src)) 830fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 879fixed (float* psrc = &MemoryMarshal.GetReference(src)) 880fixed (int* pidx = &MemoryMarshal.GetReference(idx)) 881fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 927fixed (float* psrc1 = &MemoryMarshal.GetReference(src1)) 928fixed (float* psrc2 = &MemoryMarshal.GetReference(src2)) 929fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 976fixed (float* pSrc = &MemoryMarshal.GetReference(src)) 1064fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1108fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1156fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1200fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1249fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1293fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1344fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1345fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 1399fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1400fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 1401fixed (int* pidx = &MemoryMarshal.GetReference(idx)) 1455fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1456fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 1507fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1508fixed (float* pdst1 = &MemoryMarshal.GetReference(v)) 1509fixed (float* pdst2 = &MemoryMarshal.GetReference(w)) 1567fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1568fixed (int* pidx = &MemoryMarshal.GetReference(indices)) 1569fixed (float* pdst1 = &MemoryMarshal.GetReference(v)) 1570fixed (float* pdst2 = &MemoryMarshal.GetReference(w))
SseIntrinsics.cs (42)
357fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 389fixed (float* pd = &MemoryMarshal.GetReference(dst)) 491fixed (float* psrc = &MemoryMarshal.GetReference(src)) 492fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 526fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 561fixed (float* psrc = &MemoryMarshal.GetReference(src)) 562fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 603fixed (float* psrc = &MemoryMarshal.GetReference(src)) 604fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 605fixed (float* pres = &MemoryMarshal.GetReference(result)) 647fixed (float* psrc = &MemoryMarshal.GetReference(src)) 648fixed (int* pidx = &MemoryMarshal.GetReference(idx)) 649fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 685fixed (float* psrc = &MemoryMarshal.GetReference(src)) 686fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 723fixed (float* psrc = &MemoryMarshal.GetReference(src)) 724fixed (int* pidx = &MemoryMarshal.GetReference(idx)) 725fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 759fixed (float* psrc1 = &MemoryMarshal.GetReference(src1)) 760fixed (float* psrc2 = &MemoryMarshal.GetReference(src2)) 761fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 796fixed (float* pSrc = &MemoryMarshal.GetReference(src)) 881fixed (float* psrc = &MemoryMarshal.GetReference(src)) 912fixed (float* psrc = &MemoryMarshal.GetReference(src)) 946fixed (float* psrc = &MemoryMarshal.GetReference(src)) 977fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1011fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1042fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1078fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1079fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 1120fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1121fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 1122fixed (int* pidx = &MemoryMarshal.GetReference(idx)) 1163fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1164fixed (float* pdst = &MemoryMarshal.GetReference(dst)) 1201fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1202fixed (float* pdst1 = &MemoryMarshal.GetReference(v)) 1203fixed (float* pdst2 = &MemoryMarshal.GetReference(w)) 1246fixed (float* psrc = &MemoryMarshal.GetReference(src)) 1247fixed (int* pidx = &MemoryMarshal.GetReference(indices)) 1248fixed (float* pdst1 = &MemoryMarshal.GetReference(v)) 1249fixed (float* pdst2 = &MemoryMarshal.GetReference(w))
Microsoft.ML.Data (12)
DataLoadSave\Binary\UnsafeTypeOps.cs (12)
57fixed (sbyte* pArray = &MemoryMarshal.GetReference(array)) 69fixed (Byte* pArray = &MemoryMarshal.GetReference(array)) 81fixed (short* pArray = &MemoryMarshal.GetReference(array)) 93fixed (UInt16* pArray = &MemoryMarshal.GetReference(array)) 105fixed (int* pArray = &MemoryMarshal.GetReference(array)) 117fixed (UInt32* pArray = &MemoryMarshal.GetReference(array)) 129fixed (long* pArray = &MemoryMarshal.GetReference(array)) 141fixed (UInt64* pArray = &MemoryMarshal.GetReference(array)) 153fixed (Single* pArray = &MemoryMarshal.GetReference(array)) 165fixed (Double* pArray = &MemoryMarshal.GetReference(array)) 177fixed (TimeSpan* pArray = &MemoryMarshal.GetReference(array)) 194fixed (DataViewRowId* pArray = &MemoryMarshal.GetReference(array))
Microsoft.ML.ImageAnalytics (2)
ImagePixelExtractor.cs (2)
357Span<float> vf = typeof(TValue) == typeof(float) ? MemoryMarshal.Cast<TValue, float>(editor.Values) : default; 358Span<byte> vb = typeof(TValue) == typeof(byte) ? MemoryMarshal.Cast<TValue, byte>(editor.Values) : default;
Microsoft.ML.Tokenizers (2)
Utils\ValueStringBuilder.cs (2)
66return ref MemoryMarshal.GetReference(_chars); 80return ref MemoryMarshal.GetReference(_chars);
Microsoft.ML.Vision (2)
ImageClassificationTrainer.cs (2)
894var labelsSpan = MemoryMarshal.Cast<long, byte>(labels); 906var featureSpan = MemoryMarshal.Cast<float, byte>(row.Item2);
mscorlib (1)
mscorlib.cs (1)
102[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))]
netstandard (1)
netstandard.cs (1)
1716[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))]
System.Collections (8)
System\Collections\BitArray.cs (8)
136ref byte value = ref Unsafe.As<bool, byte>(ref MemoryMarshal.GetArrayDataReference<bool>(values)); 347ref int left = ref MemoryMarshal.GetArrayDataReference<int>(thisArray); 348ref int right = ref MemoryMarshal.GetArrayDataReference<int>(valueArray); 420ref int left = ref MemoryMarshal.GetArrayDataReference<int>(thisArray); 421ref int right = ref MemoryMarshal.GetArrayDataReference<int>(valueArray); 493ref int left = ref MemoryMarshal.GetArrayDataReference<int>(thisArray); 494ref int right = ref MemoryMarshal.GetArrayDataReference<int>(valueArray); 560ref int value = ref MemoryMarshal.GetArrayDataReference<int>(thisArray);
System.Collections.Immutable (2)
System\Collections\Frozen\String\Hashing.cs (2)
25fixed (char* src = &MemoryMarshal.GetReference(s)) 89fixed (char* src = &MemoryMarshal.GetReference(s))
System.Console (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System.Diagnostics.DiagnosticSource (9)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Diagnostics\Activity.cs (1)
1989_hexString = Convert.ToHexStringLower(MemoryMarshal.AsBytes(span));
System\Diagnostics\Metrics\ObjectSequence.netcore.cs (3)
18return MemoryMarshal.CreateSpan(ref Value1, 1); 26return MemoryMarshal.CreateSpan(ref Value1, 2); 36return MemoryMarshal.CreateSpan(ref Value1, 3);
System\Diagnostics\Metrics\StringSequence.netcore.cs (3)
19return MemoryMarshal.CreateSpan(ref Value1, 1); 27return MemoryMarshal.CreateSpan(ref Value1, 2); 37return MemoryMarshal.CreateSpan(ref Value1, 3);
System.Diagnostics.Process (4)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
40ref byte pathReference = ref MemoryMarshal.GetReference(converter.ConvertAndTerminateString(path)); 46int resultLength = ReadLink(ref pathReference, ref MemoryMarshal.GetReference(spanBuffer), spanBuffer.Length);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System.Formats.Asn1 (4)
System\Formats\Asn1\AsnCharacterStringEncodings.cs (3)
45fixed (char* strPtr = &MemoryMarshal.GetReference(str)) 68fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 69fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
System\Formats\Asn1\AsnDecoder.Text.cs (1)
457fixed (byte* bytePtr = &MemoryMarshal.GetReference(contents))
System.Formats.Cbor (1)
System\Formats\Cbor\Writer\CborWriter.cs (1)
155fixed (byte* ptr = &MemoryMarshal.GetReference(encodedValue))
System.Formats.Nrbf (6)
System\Formats\Nrbf\ArraySinglePrimitiveRecord.cs (5)
113Span<byte> resultAsBytes = MemoryMarshal.AsBytes<T>(result); 139Span<short> span = MemoryMarshal.Cast<T, short>(result); 151Span<int> span = MemoryMarshal.Cast<T, int>(result); 163Span<long> span = MemoryMarshal.Cast<T, long>(result); 179resultAsBytes = MemoryMarshal.AsBytes<T>(result);
System\Formats\Nrbf\RectangularArrayRecord.cs (1)
118ref byte arrayDataRef = ref MemoryMarshal.GetArrayDataReference(array);
System.Formats.Tar (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System.IO.Compression (3)
System\IO\Compression\Crc32Helper.ZLib.cs (1)
23fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer))
System\IO\Compression\DeflateZLib\DeflateStream.cs (1)
557fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer))
System\IO\Compression\DeflateZLib\Inflater.cs (1)
81fixed (byte* bufPtr = &MemoryMarshal.GetReference(destination))
System.IO.Compression.Brotli (8)
System\IO\Compression\dec\BrotliDecoder.cs (4)
73fixed (byte* inBytes = &MemoryMarshal.GetReference(source)) 74fixed (byte* outBytes = &MemoryMarshal.GetReference(destination)) 116fixed (byte* inBytes = &MemoryMarshal.GetReference(source)) 117fixed (byte* outBytes = &MemoryMarshal.GetReference(destination))
System\IO\Compression\enc\BrotliEncoder.cs (4)
158fixed (byte* inBytes = &MemoryMarshal.GetReference(source)) 159fixed (byte* outBytes = &MemoryMarshal.GetReference(destination)) 214fixed (byte* inBytes = &MemoryMarshal.GetReference(source)) 215fixed (byte* outBytes = &MemoryMarshal.GetReference(destination))
System.IO.FileSystem.Watcher (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System.IO.Hashing (16)
System\IO\Hashing\Crc32.Arm.cs (2)
20ref byte ptr = ref MemoryMarshal.GetReference(source); 48ref byte ptr = ref MemoryMarshal.GetReference(source);
System\IO\Hashing\Crc32.Vectorized.cs (2)
38ref byte srcRef = ref MemoryMarshal.GetReference(source); 121? UpdateScalar(result, MemoryMarshal.CreateReadOnlySpan(ref srcRef, length))
System\IO\Hashing\Crc64.Vectorized.cs (2)
52ref byte srcRef = ref MemoryMarshal.GetReference(source); 156? UpdateScalar(result, MemoryMarshal.CreateReadOnlySpan(ref srcRef, length))
System\IO\Hashing\XxHash128.cs (3)
129fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 222ref byte dest0 = ref MemoryMarshal.GetReference(destination); 390fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
System\IO\Hashing\XxHash3.cs (3)
109Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), hash); 127fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 357fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
System\IO\Hashing\XxHashShared.cs (4)
122ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 140ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3)); 258fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) 480fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret))
System.Linq (5)
System\Linq\MaxMin.cs (3)
53ref T current = ref MemoryMarshal.GetReference(span); 77ref T current = ref MemoryMarshal.GetReference(span); 101ref T current = ref MemoryMarshal.GetReference(span);
System\Linq\Range.cs (1)
81ref int pos = ref MemoryMarshal.GetReference(destination);
System\Linq\Sum.cs (1)
87ref T ptr = ref MemoryMarshal.GetReference(span);
System.Memory (8)
artifacts\obj\System.Memory\Debug\net10.0\System.Memory.Forwards.cs (1)
17[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))]
System\Buffers\ReadOnlySequence.cs (3)
146if (MemoryMarshal.TryGetMemoryManager(memory, out MemoryManager<T>? manager, out int index, out int length)) 153else if (MemoryMarshal.TryGetArray(memory, out ArraySegment<T> segment)) 164if (!MemoryMarshal.TryGetString((ReadOnlyMemory<char>)(object)memory, out string? text, out int start, out length))
System\Buffers\ReadOnlySequence.Helpers.cs (2)
688return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<char, T>(ref MemoryMarshal.GetReference(spanOfChar)), spanOfChar.Length);
System\Buffers\SequenceReaderExtensions.Binary.cs (2)
32value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(span)); 51value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(tempSpan));
System.Net.Http (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Net\Http\Headers\HttpHeaders.cs (1)
1465ref HeaderEntry firstEntry = ref MemoryMarshal.GetArrayDataReference(entries);
System\Net\Http\Headers\KnownHeaders.cs (1)
428fixed (byte* p = &MemoryMarshal.GetReference(name))
System.Net.Mail (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System.Net.NameResolution (6)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.IPAddress.cs (2)
38h.AddBytes(MemoryMarshal.CreateReadOnlySpan(ref Address[0], IsIPv6 ? IPv6AddressBytes : IPv4AddressBytes)); 71return MemoryMarshal.CreateReadOnlySpan(ref Address[0], addressByteCount).SequenceEqual(
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
116fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 129fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 130fixed (byte* ipAddress = &MemoryMarshal.GetReference(address)) 159fixed (byte* rawInput = &MemoryMarshal.GetReference(address))
System.Net.Ping (8)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
116fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 129fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 130fixed (byte* ipAddress = &MemoryMarshal.GetReference(address)) 159fixed (byte* rawInput = &MemoryMarshal.GetReference(address))
System\Net\NetworkInformation\Ping.RawSocket.cs (4)
148IcmpHeader receivedHeader = MemoryMarshal.Read<IcmpHeader>(receiveBuffer.AsSpan(icmpHeaderOffset)); 183IcmpHeader originalRequestHeader = MemoryMarshal.Read<IcmpHeader>(receiveBuffer.AsSpan(dataOffset + payloadIpHeaderLength)); 216IcmpHeader originalRequestHeader = MemoryMarshal.Read<IcmpHeader>(receiveBuffer.AsSpan(dataOffset + IpV6HeaderLengthInBytes)); 308fixed (byte* sockAddr = &MemoryMarshal.GetReference(socketAddress))
System.Net.Primitives (36)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.IPAddress.cs (2)
38h.AddBytes(MemoryMarshal.CreateReadOnlySpan(ref Address[0], IsIPv6 ? IPv6AddressBytes : IPv4AddressBytes)); 71return MemoryMarshal.CreateReadOnlySpan(ref Address[0], addressByteCount).SequenceEqual(
src\libraries\Common\src\System\Net\NetworkInformation\InterfaceInfoPal.Unix.cs (3)
37ReadOnlySpan<char> castInterfaceName = MemoryMarshal.Cast<TChar, char>(interfaceName); 52ReadOnlySpan<byte> castInterfaceName = MemoryMarshal.Cast<TChar, byte>(interfaceName); 58ReadOnlySpan<char> castInterfaceName = MemoryMarshal.Cast<TChar, char>(interfaceName);
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
116fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 129fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 130fixed (byte* ipAddress = &MemoryMarshal.GetReference(address)) 159fixed (byte* rawInput = &MemoryMarshal.GetReference(address))
System\Net\IPAddress.cs (20)
188PrivateAddress = MemoryMarshal.Read<uint>(address); 206Vector128<ushort> ushorts = Vector128.LoadUnsafe(ref MemoryMarshal.GetReference(address)).AsUInt16(); 212ushorts.StoreUnsafe(ref MemoryMarshal.GetArrayDataReference(numbers)); 356Vector128<ushort> ushorts = Vector128.LoadUnsafe(ref MemoryMarshal.GetArrayDataReference(numbers)); 358ushorts.AsByte().StoreUnsafe(ref MemoryMarshal.GetReference(destination)); 370MemoryMarshal.AsBytes<ushort>(numbers).CopyTo(destination); 378MemoryMarshal.Write(destination, in address); 641ReadOnlySpan<byte> numbers = MemoryMarshal.AsBytes(new ReadOnlySpan<ushort>(_numbers)); 643MemoryMarshal.Read<ulong>(numbers) == 0 && 698ReadOnlySpan<byte> thisNumbers = MemoryMarshal.AsBytes<ushort>(_numbers); 699ReadOnlySpan<byte> comparandNumbers = MemoryMarshal.AsBytes<ushort>(comparand._numbers); 701MemoryMarshal.Read<ulong>(thisNumbers) == MemoryMarshal.Read<ulong>(comparandNumbers) && 702MemoryMarshal.Read<ulong>(thisNumbers.Slice(sizeof(ulong))) == MemoryMarshal.Read<ulong>(comparandNumbers.Slice(sizeof(ulong))) && 720ReadOnlySpan<byte> numbers = MemoryMarshal.AsBytes<ushort>(_numbers); 722MemoryMarshal.Read<uint>(numbers), 723MemoryMarshal.Read<uint>(numbers.Slice(4)), 724MemoryMarshal.Read<uint>(numbers.Slice(8)), 725MemoryMarshal.Read<uint>(numbers.Slice(12)),
System\Net\IPAddressParser.cs (4)
54fixed (TChar* ipStringPtr = &MemoryMarshal.GetReference(ipSpan)) 80fixed (TChar* ipStringPtr = &MemoryMarshal.GetReference(ipSpan)) 98ReadOnlySpan<byte> castScopeIdSpan = MemoryMarshal.Cast<TChar, byte>(scopeIdSpan); 104ReadOnlySpan<char> castScopeIdSpan = MemoryMarshal.Cast<TChar, char>(scopeIdSpan);
System\Net\IPNetwork.cs (3)
113BaseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<UInt128>(ref baseAddressValue)), out int bytesWritten); 115address.TryWriteBytes(MemoryMarshal.AsBytes(new Span<UInt128>(ref otherAddressValue)), out bytesWritten); 266baseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<UInt128>(ref value)), out int bytesWritten);
System.Net.Quic (88)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (1)
44BioWrite(b, ref MemoryMarshal.GetReference(data), data.Length);
src\libraries\Common\src\System\Net\Security\TargetHostNameHelper.cs (2)
58fixed (char* ipStringPtr = &MemoryMarshal.GetReference(ipSpan)) 67fixed (char* ipStringPtr = &MemoryMarshal.GetReference(ipSpan))
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
116fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 129fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 130fixed (byte* ipAddress = &MemoryMarshal.GetReference(address)) 159fixed (byte* rawInput = &MemoryMarshal.GetReference(address))
System\Net\Quic\Internal\MsQuicHelpers.cs (2)
52Span<byte> rawAddress = MemoryMarshal.AsBytes(MemoryMarshal.CreateSpan(ref result, 1));
System\Net\Quic\Interop\msquic_generated.cs (79)
14using MemoryMarshal = System.Runtime.InteropServices.MemoryMarshal; 315return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref this, 1)).Anonymous.CertificateHash; 323return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref this, 1)).Anonymous.CertificateHashStore; 331return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref this, 1)).Anonymous.CertificateContext; 339return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref this, 1)).Anonymous.CertificateFile; 347return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref this, 1)).Anonymous.CertificateFileProtected; 355return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref this, 1)).Anonymous.CertificatePkcs12; 975return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.IsSetFlags, 1)); 983return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.IsSet, 1)); 1263return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous1.IsSetFlags, 1)); 1271return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous1.IsSet, 1)); 1279return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous2.Flags, 1)); 2231return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.NEW_CONNECTION, 1)); 2239return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.STOP_COMPLETE, 1)); 2331return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.CONNECTED, 1)); 2339return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.SHUTDOWN_INITIATED_BY_TRANSPORT, 1)); 2347return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.SHUTDOWN_INITIATED_BY_PEER, 1)); 2355return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.SHUTDOWN_COMPLETE, 1)); 2363return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.LOCAL_ADDRESS_CHANGED, 1)); 2371return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.PEER_ADDRESS_CHANGED, 1)); 2379return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.PEER_STREAM_STARTED, 1)); 2387return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.STREAMS_AVAILABLE, 1)); 2395return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.PEER_NEEDS_STREAMS, 1)); 2403return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.IDEAL_PROCESSOR_CHANGED, 1)); 2411return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.DATAGRAM_STATE_CHANGED, 1)); 2419return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.DATAGRAM_RECEIVED, 1)); 2427return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.DATAGRAM_SEND_STATE_CHANGED, 1)); 2435return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.RESUMED, 1)); 2443return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.RESUMPTION_TICKET_RECEIVED, 1)); 2451return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.PEER_CERTIFICATE_RECEIVED, 1)); 2459return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.RELIABLE_RESET_NEGOTIATED, 1)); 2467return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.ONE_WAY_DELAY_NEGOTIATED, 1)); 2763return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.START_COMPLETE, 1)); 2771return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.RECEIVE, 1)); 2779return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.SEND_COMPLETE, 1)); 2787return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.PEER_SEND_ABORTED, 1)); 2795return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.PEER_RECEIVE_ABORTED, 1)); 2803return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.SEND_SHUTDOWN_COMPLETE, 1)); 2811return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.SHUTDOWN_COMPLETE, 1)); 2819return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.IDEAL_SEND_BUFFER_SIZE, 1));
System.Net.Security (25)
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.NetSecurityNative.cs (3)
124ref MemoryMarshal.GetReference(inputBytes), 154ref MemoryMarshal.GetReference(inputBytes), 185ref MemoryMarshal.GetReference(inputBytes),
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (1)
44BioWrite(b, ref MemoryMarshal.GetReference(data), data.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (1)
87ref MemoryMarshal.GetReference(buf),
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (6)
521if (Ssl.BioWrite(context.InputBio!, ref MemoryMarshal.GetReference(input), input.Length) != input.Length) 597int retVal = Ssl.SslWrite(context, ref MemoryMarshal.GetReference(input), input.Length, out Ssl.SslErrorCode errorCode); 638int retVal = Ssl.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode); 742fixed (byte* p = &MemoryMarshal.GetReference(clientProto)) *outp = p; 830ReadOnlySpan<byte> data = MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)line); 849int bytes = Ssl.BioWrite(bio, ref MemoryMarshal.GetReference(buffer), buffer.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (2)
246fixed (byte* pBuffer = &MemoryMarshal.GetReference(serializedProtocols)) 262fixed (IntPtr* pHandles = &MemoryMarshal.GetReference(x509handles))
src\libraries\Common\src\System\Net\Security\TargetHostNameHelper.cs (2)
58fixed (char* ipStringPtr = &MemoryMarshal.GetReference(ipSpan)) 67fixed (char* ipStringPtr = &MemoryMarshal.GetReference(ipSpan))
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (8)
300ref NegotiateMessage message = ref MemoryMarshal.AsRef<NegotiateMessage>(asBytes); 341Span<byte> span = MemoryMarshal.AsBytes(new Span<MessageField>(ref field)); 405ref NtChallengeResponse temp = ref MemoryMarshal.AsRef<NtChallengeResponse>(blob.Slice(0, sizeof(NtChallengeResponse))); 411clientChallenge.CopyTo(MemoryMarshal.CreateSpan(ref temp.ClientChallenge[0], ChallengeLength)); 412serverInfo.CopyTo(MemoryMarshal.CreateSpan(ref temp.ServerInfo[0], serverInfo.Length)); 567ref readonly ChallengeMessage challengeMessage = ref MemoryMarshal.AsRef<ChallengeMessage>(blob.Slice(0, sizeof(ChallengeMessage))); 621ref AuthenticateMessage response = ref MemoryMarshal.AsRef<AuthenticateMessage>(responseAsSpan.Slice(0, sizeof(AuthenticateMessage))); 684hmacMic.GetHashAndReset(MemoryMarshal.CreateSpan(ref response.Mic[0], hmacMic.HashLengthInBytes));
System\Net\Security\SslStream.cs (2)
783fixed (byte* ptr = &MemoryMarshal.GetReference(buffer)) 815fixed (byte* ptr = &MemoryMarshal.GetReference(buffer))
System.Net.Sockets (24)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.IPAddress.cs (2)
38h.AddBytes(MemoryMarshal.CreateReadOnlySpan(ref Address[0], IsIPv6 ? IPv6AddressBytes : IPv4AddressBytes)); 71return MemoryMarshal.CreateReadOnlySpan(ref Address[0], addressByteCount).SequenceEqual(
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
116fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 129fixed (byte* rawAddress = &MemoryMarshal.GetReference(buffer)) 130fixed (byte* ipAddress = &MemoryMarshal.GetReference(address)) 159fixed (byte* rawInput = &MemoryMarshal.GetReference(address))
System\Net\Sockets\Socket.cs (1)
314fixed (byte* ptr = &MemoryMarshal.GetReference(buffer))
System\Net\Sockets\Socket.Tasks.cs (4)
570saea.SetBuffer(MemoryMarshal.AsMemory(buffer)); 588saea.SetBuffer(MemoryMarshal.AsMemory(buffer)); 678saea.SetBuffer(MemoryMarshal.AsMemory(buffer)); 708saea.SetBuffer(MemoryMarshal.AsMemory(buffer));
System\Net\Sockets\SocketAsyncContext.Unix.cs (3)
1647fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer)) 1867fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer)) 1991fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer))
System\Net\Sockets\SocketAsyncEventArgs.cs (1)
123bool success = MemoryMarshal.TryGetArray(_buffer, out ArraySegment<byte> arraySegment);
System\Net\Sockets\SocketPal.Unix.cs (9)
111fixed (byte* b = &MemoryMarshal.GetReference(buffer)) 126fixed (byte* b = &MemoryMarshal.GetReference(buffer)) 150fixed (byte* sockAddr = &MemoryMarshal.GetReference(socketAddress)) 151fixed (byte* b = &MemoryMarshal.GetReference(buffer)) 191fixed (byte* b = &MemoryMarshal.GetReference(buffer)) 212Unsafe.IsNullRef(ref MemoryMarshal.GetReference(buffer)) ? Array.Empty<byte>() : buffer; 221fixed (byte* b = &MemoryMarshal.GetReference(buffer)) 249fixed (byte* b = &MemoryMarshal.GetReference(buffer)) 494fixed (byte* b = &MemoryMarshal.GetReference(buffer))
System.Net.WebSockets (3)
System\Net\WebSockets\ManagedWebSocket.cs (1)
1667fixed (byte* toMaskBeg = &MemoryMarshal.GetReference(toMask))
System\Net\WebSockets\WebSocket.cs (2)
37if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> arraySegment)) 57MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> arraySegment) ?
System.Numerics.Tensors (182)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (27)
40ref T xRef = ref MemoryMarshal.GetReference(x); 1158ref T xRef = ref MemoryMarshal.GetReference(x); 1159ref T yRef = ref MemoryMarshal.GetReference(y); 2368ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2375ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2382ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2389ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2404ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2411ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2418ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2425ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2440ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2447ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2454ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2461ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2476ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2483ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2490ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2497ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)), 2512ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2519ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2526ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2533ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)), 2548ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2555ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2562ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2569ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)),
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (5)
79ref T xRef = ref MemoryMarshal.GetReference(x); 80ref T yRef = ref MemoryMarshal.GetReference(y); 81ref T dRef = ref MemoryMarshal.GetReference(destination); 1412ref T xRef = ref MemoryMarshal.GetReference(x); 1413ref T dRef = ref MemoryMarshal.GetReference(destination);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IStatefulUnaryOperator.cs (2)
46ref T xRef = ref MemoryMarshal.GetReference(x); 47ref T dRef = ref MemoryMarshal.GetReference(destination);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.ITernaryOperator.cs (10)
54ref T xRef = ref MemoryMarshal.GetReference(x); 55ref T yRef = ref MemoryMarshal.GetReference(y); 56ref T zRef = ref MemoryMarshal.GetReference(z); 57ref T dRef = ref MemoryMarshal.GetReference(destination); 1530ref T xRef = ref MemoryMarshal.GetReference(x); 1531ref T yRef = ref MemoryMarshal.GetReference(y); 1532ref T dRef = ref MemoryMarshal.GetReference(destination); 3009ref T xRef = ref MemoryMarshal.GetReference(x); 3010ref T zRef = ref MemoryMarshal.GetReference(z); 3011ref T dRef = ref MemoryMarshal.GetReference(destination);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryInputBinaryOutput.cs (3)
42ref T sourceRef = ref MemoryMarshal.GetReference(x); 43ref T destination1Ref = ref MemoryMarshal.GetReference(destination1); 44ref T destination2Ref = ref MemoryMarshal.GetReference(destination2);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOneToFourOperator.cs (2)
40ref TInput sourceRef = ref MemoryMarshal.GetReference(x); 41ref TOutput destinationRef = ref MemoryMarshal.GetReference(destination);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOneToTwoOperator.cs (2)
40ref TInput sourceRef = ref MemoryMarshal.GetReference(x); 41ref TOutput destinationRef = ref MemoryMarshal.GetReference(destination);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOperator.cs (2)
86ref TInput xRef = ref MemoryMarshal.GetReference(x); 87ref TOutput dRef = ref MemoryMarshal.GetReference(destination);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryTwoToOneOperator.cs (2)
40ref TInput xRef = ref MemoryMarshal.GetReference(x); 41ref TOutput destinationRef = ref MemoryMarshal.GetReference(destination);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan.cs (4)
106_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 136_reference = ref MemoryMarshal.GetReference(span); 187_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)startOffset /* force zero-extension */); 231_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)startOffset /* force zero-extension */);
System\Numerics\Tensors\netcore\Tensor.cs (4)
379public static implicit operator TensorSpan<T>(Tensor<T> value) => new TensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(value._values), value._lengths, value._strides, value._flattenedLength); 384public static implicit operator ReadOnlyTensorSpan<T>(Tensor<T> value) => new ReadOnlyTensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(value._values), value._lengths, value._strides, value.FlattenedLength); 390public TensorSpan<T> AsTensorSpan() => new TensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(_values), _lengths, _strides, _flattenedLength); 417public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan() => new ReadOnlyTensorSpan<T>(ref MemoryMarshal.GetArrayDataReference(_values), _lengths, _strides, _flattenedLength);
System\Numerics\Tensors\netcore\Tensor.Factory.cs (2)
191Span<T> span = MemoryMarshal.CreateSpan<T>(ref destination._reference, (int)destination._shape._memoryLength); 208Span<T> span = MemoryMarshal.CreateSpan<T>(ref destination._reference, (int)destination._shape._memoryLength);
System\Numerics\Tensors\netcore\TensorExtensions.cs (75)
87intermediate.FlattenTo(MemoryMarshal.CreateSpan(ref output._values[0], (int)output.FlattenedLength)); 105intermediate.FlattenTo(MemoryMarshal.CreateSpan(ref destination._reference, (int)destination.FlattenedLength)); 120intermediate.FlattenTo(MemoryMarshal.CreateSpan(ref destination._reference, (int)destination.FlattenedLength)); 135intermediate.FlattenTo(MemoryMarshal.CreateSpan(ref destination._reference, (int)destination.FlattenedLength)); 392Span<T> dstSpan = MemoryMarshal.CreateSpan(ref destination._reference, (int)totalLength); 419Span<T> srcSpan = MemoryMarshal.CreateSpan(ref tensors[i]._values[srcIndex], (int)copyLength); 766Span<T> srcSpan = MemoryMarshal.CreateSpan(ref tensor._reference, (int)tensor._shape._memoryLength); 767Span<bool> filterSpan = MemoryMarshal.CreateSpan(ref filter._reference, (int)tensor._shape._memoryLength); 794Span<T> dstSpan = MemoryMarshal.CreateSpan(ref tensor._reference, (int)tensor._shape._memoryLength); 795Span<bool> filterSpan = MemoryMarshal.CreateSpan(ref filter._reference, (int)tensor._shape._memoryLength); 796Span<T> valuesSpan = MemoryMarshal.CreateSpan(ref values._reference, (int)values._shape._memoryLength); 2945ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref tensor.AsTensorSpan()._reference, (int)tensor._values.Length); 2946Span<T> ospan = MemoryMarshal.CreateSpan(ref output.AsTensorSpan()._reference, (int)output.FlattenedLength); 2963ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref tensor._values[0], tensor._values.Length); 2964Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 2979ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref tensor._reference, (int)tensor._shape._memoryLength); 2980Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 2995ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref tensor._reference, (int)tensor._shape._memoryLength); 2996Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 3053Span<T> inputSpan = MemoryMarshal.CreateSpan(ref tensor._reference, (int)tensor._shape._memoryLength); 3054Span<T> outputSpan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 3125&& MemoryMarshal.CreateReadOnlySpan(in tensor.GetPinnableReference(), (int)tensor._shape._memoryLength).SequenceEqual(MemoryMarshal.CreateReadOnlySpan(in other.GetPinnableReference(), (int)other._shape._memoryLength)); 3137&& MemoryMarshal.CreateReadOnlySpan(in tensor.GetPinnableReference(), (int)tensor._shape._memoryLength).SequenceEqual(MemoryMarshal.CreateReadOnlySpan(in other.GetPinnableReference(), (int)other._shape._memoryLength)); 3519Span<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 4649Span<T> values = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 4663lspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref x._reference, TensorSpanHelpers.ComputeLinearIndex(leftIndexes, x.Strides, x.Lengths)), (int)rowLength); 4664rspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref y._reference, TensorSpanHelpers.ComputeLinearIndex(rightIndexes, y.Strides, y.Lengths)), (int)rowLength); 5159ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 5170ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 5181ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 5194ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 5960ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 5961Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 6205ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 6206Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 6236ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 6237Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 6267ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 6268Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 6317ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 6318Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 6344ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 6345Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 6371ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); 6372Span<T> ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 6815ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape.FlattenedLength); 6835ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref left._reference, (int)left._shape.FlattenedLength); 6836ReadOnlySpan<T> rspan = MemoryMarshal.CreateSpan(ref right._reference, (int)right._shape.FlattenedLength); 6856ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref broadcastedLeft._reference, (int)broadcastedLeft.FlattenedLength); 6857ReadOnlySpan<T> rspan = MemoryMarshal.CreateSpan(ref broadcastedRight._reference, (int)broadcastedRight.FlattenedLength); 6877inputSpan = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape.FlattenedLength); 6878destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination._reference, (int)slicedDestination._shape.FlattenedLength); 6902inputSpan = MemoryMarshal.CreateReadOnlySpan(in input[curIndex], (int)rowLength); 6903destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination[curIndex], (int)rowLength); 6929inputSpan = MemoryMarshal.CreateSpan(ref input._reference, (int)input.FlattenedLength); 6930destinationSpan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination.FlattenedLength); 6954inputSpan = MemoryMarshal.CreateReadOnlySpan(in input[curIndex], (int)rowLength); 6955destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination[curIndex], (int)rowLength); 6981inputSpan = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); 6982destinationSpan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); 7006inputSpan = MemoryMarshal.CreateReadOnlySpan(in input[curIndex], (int)rowLength); 7007destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination[curIndex], (int)rowLength); 7030ReadOnlySpan<T> span = MemoryMarshal.CreateSpan(ref left._reference, left._shape._memoryLength <= left.FlattenedLength ? (int)left._shape._memoryLength : (int)left.FlattenedLength); 7031ReadOnlySpan<T> rspan = MemoryMarshal.CreateSpan(ref right._reference, right._shape._memoryLength <= right.FlattenedLength ? (int)right._shape._memoryLength : (int)right.FlattenedLength); 7032Span<T> ospan = MemoryMarshal.CreateSpan(ref slicedDestination._reference, (int)slicedDestination._shape._memoryLength); 7073ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); 7086ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); 7088ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.Lengths)), (int)rowLength); 7099ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); 7101ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.Lengths)), (int)rowLength); 7113ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); 7114ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.Lengths)), (int)rowLength); 7115rspan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.Lengths)), (int)rowLength);
System\Numerics\Tensors\netcore\TensorHelpers.cs (1)
22Span<bool> filterSpan = MemoryMarshal.CreateSpan(ref filter._reference, (int)filter._shape._memoryLength);
System\Numerics\Tensors\netcore\TensorPrimitives.CosineSimilarity.cs (6)
54ref T xRef = ref MemoryMarshal.GetReference(x); 55ref T yRef = ref MemoryMarshal.GetReference(y); 100ref T xRef = ref MemoryMarshal.GetReference(x); 101ref T yRef = ref MemoryMarshal.GetReference(y); 146ref T xRef = ref MemoryMarshal.GetReference(x); 147ref T yRef = ref MemoryMarshal.GetReference(y);
System\Numerics\Tensors\netcore\TensorPrimitives.HammingDistance.cs (10)
55MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(x)), x.Length), 56MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(y)), y.Length)); 81ref T xRef = ref MemoryMarshal.GetReference(x); 82ref T yRef = ref MemoryMarshal.GetReference(y); 112ref T xRef = ref MemoryMarshal.GetReference(x); 113ref T yRef = ref MemoryMarshal.GetReference(y); 145ref T xRef = ref MemoryMarshal.GetReference(x); 146ref T yRef = ref MemoryMarshal.GetReference(y);
System\Numerics\Tensors\netcore\TensorPrimitives.IndexOfMax.cs (3)
159ref T xRef = ref MemoryMarshal.GetReference(x); 250ref T xRef = ref MemoryMarshal.GetReference(x); 341ref T xRef = ref MemoryMarshal.GetReference(x);
System\Numerics\Tensors\netcore\TensorPrimitives.Max.cs (3)
390ref T xRef = ref MemoryMarshal.GetReference(x); 455ref T xRef = ref MemoryMarshal.GetReference(x); 521ref T xRef = ref MemoryMarshal.GetReference(x);
System\Numerics\Tensors\netcore\TensorShape.cs (6)
36lengths.CopyTo(MemoryMarshal.CreateSpan(ref _metadata[0], lengths.Length)); 37strides.CopyTo(MemoryMarshal.CreateSpan(ref _metadata[lengths.Length], strides.Length)); 55: MemoryMarshal.CreateReadOnlySpan(ref MemoryMarshal.GetArrayDataReference(_metadata), _rank); 60: MemoryMarshal.CreateReadOnlySpan(ref MemoryMarshal.GetArrayDataReference(_metadata), _rank * 2).Slice(_rank);
System\Numerics\Tensors\netcore\TensorSpan.cs (5)
108_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 139_reference = ref MemoryMarshal.GetReference(span); 191_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)startOffset /* force zero-extension */); 234_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)startOffset /* force zero-extension */); 537MemoryMarshal.CreateSpan<T>(ref _reference, (int)_shape._memoryLength).Fill(value);
System\Numerics\Tensors\netcore\TensorSpanHelpers.T.cs (6)
18MemoryMarshal.CreateSpan(ref source, checked((int)length)).CopyTo(destination); 23MemoryMarshal.CreateSpan(ref source, checked((int)length)).CopyTo(MemoryMarshal.CreateSpan(ref destination, checked((int)length))); 28MemoryMarshal.CreateSpan(ref source, checked((int)length)).CopyTo(destination); 36MemoryMarshal.CreateSpan(ref dest, (int)toClear).Clear(); 47MemoryMarshal.CreateSpan(ref dest, (int)toFill).Fill(value);
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (2)
18if (!Unsafe.AreSame(ref MemoryMarshal.GetReference(input), ref MemoryMarshal.GetReference(output)) &&
System.Private.CoreLib (1170)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs (1)
18int result = MkDir(ref MemoryMarshal.GetReference(converter.ConvertAndTerminateString(path)), mode);
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
40ref byte pathReference = ref MemoryMarshal.GetReference(converter.ConvertAndTerminateString(path)); 46int resultLength = ReadLink(ref pathReference, ref MemoryMarshal.GetReference(spanBuffer), spanBuffer.Length);
src\libraries\Common\src\Interop\Unix\System.Native\Interop.Rename.cs (2)
31ref MemoryMarshal.GetReference(converterOldPath.ConvertAndTerminateString(oldPath)), 32ref MemoryMarshal.GetReference(converterNewPath.ConvertAndTerminateString(newPath)));
src\libraries\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs (2)
18int result = Stat(ref MemoryMarshal.GetReference(converter.ConvertAndTerminateString(path)), out output); 29int result = LStat(ref MemoryMarshal.GetReference(converter.ConvertAndTerminateString(path)), out output);
src\libraries\Common\src\System\HexConverter.cs (4)
117ref byte srcRef = ref MemoryMarshal.GetReference(bytes); 118ref ushort destRef = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars)); 254ref ushort srcRef = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars)); 255ref byte destRef = ref MemoryMarshal.GetReference(bytes);
src\libraries\Common\src\System\Memory\FixedBufferExtensions.cs (1)
15fixed (char* c = &MemoryMarshal.GetReference(span))
src\libraries\Common\src\System\Number.Formatting.Common.cs (5)
328fixed (char* pFormat = &MemoryMarshal.GetReference(format)) 527fixed (char* pFormat = &MemoryMarshal.GetReference(format)) 793fixed (TChar* spanPtr = &MemoryMarshal.GetReference(vlb.AppendSpan(bufferSize))) 880r.EncodeToUtf8(MemoryMarshal.AsBytes(vlb.AppendSpan(r.Utf8SequenceLength))); 1135fixed (char* pFormat = &MemoryMarshal.GetReference(format))
src\libraries\Common\src\System\Number.NumberBuffer.cs (1)
33public readonly byte* DigitsPtr => (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(Digits)); // safe since constructor expects Digits to refer to unmovable memory
src\libraries\Common\src\System\Number.Parsing.Common.cs (2)
285fixed (TChar* stringPointer = &MemoryMarshal.GetReference(value)) 341fixed (TChar* stringPointer = &MemoryMarshal.GetReference(value))
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.ThreadPoolValueTaskSource.cs (1)
98Memory<byte> writableSingleSegment = MemoryMarshal.AsMemory(_singleSegment);
src\libraries\System.Private.CoreLib\src\System\Array.cs (19)
63ref MemoryMarshal.GetArrayDataReference(newArray), 64ref MemoryMarshal.GetArrayDataReference(larray), 1125ref T first = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)startIndex); 1515ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1523ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1531ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1539ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1760ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1770ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1780ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1790ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1893SpanHelpers.Reverse(ref MemoryMarshal.GetArrayDataReference(array), (nuint)array.Length); 1910SpanHelpers.Reverse(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), (nuint)length); 2111var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length); 2160var span = new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), length); 2184var spanKeys = new Span<TKey>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(keys), index), length); 2185var spanItems = new Span<TValue>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(items), index), length); 2202var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length); 2673new Span<T>(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), array.Length).Slice(adjustedIndex, length);
src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (26)
45Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value ? (byte)1 : (byte)0); 72Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 99Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 126Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 153Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 180Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 209Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 238Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 267Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 296Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 323Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 350Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 377Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 403return Unsafe.ReadUnaligned<char>(ref MemoryMarshal.GetReference(value)); 438return Unsafe.ReadUnaligned<short>(ref MemoryMarshal.GetReference(value)); 476return Unsafe.ReadUnaligned<int>(ref MemoryMarshal.GetReference(value)); 514return Unsafe.ReadUnaligned<long>(ref MemoryMarshal.GetReference(value)); 552return Unsafe.ReadUnaligned<Int128>(ref MemoryMarshal.GetReference(value)); 579return Unsafe.ReadUnaligned<ushort>(ref MemoryMarshal.GetReference(value)); 609return Unsafe.ReadUnaligned<uint>(ref MemoryMarshal.GetReference(value)); 639return Unsafe.ReadUnaligned<ulong>(ref MemoryMarshal.GetReference(value)); 679return Unsafe.ReadUnaligned<UInt128>(ref MemoryMarshal.GetReference(value)); 704return Unsafe.ReadUnaligned<Half>(ref MemoryMarshal.GetReference(value)); 732return Unsafe.ReadUnaligned<float>(ref MemoryMarshal.GetReference(value)); 760return Unsafe.ReadUnaligned<double>(ref MemoryMarshal.GetReference(value)); 886return Unsafe.ReadUnaligned<byte>(ref MemoryMarshal.GetReference(value)) != 0;
src\libraries\System.Private.CoreLib\src\System\Buffer.cs (4)
52Memmove(ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(dst), uDstOffset), ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(src), uSrcOffset), uCount); 84return Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index); 95Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index) = value;
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (52)
24BitConverter.Int64BitsToDouble(ReverseEndianness(MemoryMarshal.Read<long>(source))) : 25MemoryMarshal.Read<double>(source); 41BitConverter.Int16BitsToHalf(ReverseEndianness(MemoryMarshal.Read<short>(source))) : 42MemoryMarshal.Read<Half>(source); 58ReverseEndianness(MemoryMarshal.Read<short>(source)) : 59MemoryMarshal.Read<short>(source); 75ReverseEndianness(MemoryMarshal.Read<int>(source)) : 76MemoryMarshal.Read<int>(source); 92ReverseEndianness(MemoryMarshal.Read<long>(source)) : 93MemoryMarshal.Read<long>(source); 109ReverseEndianness(MemoryMarshal.Read<Int128>(source)) : 110MemoryMarshal.Read<Int128>(source); 126ReverseEndianness(MemoryMarshal.Read<nint>(source)) : 127MemoryMarshal.Read<nint>(source); 143BitConverter.Int32BitsToSingle(ReverseEndianness(MemoryMarshal.Read<int>(source))) : 144MemoryMarshal.Read<float>(source); 161ReverseEndianness(MemoryMarshal.Read<ushort>(source)) : 162MemoryMarshal.Read<ushort>(source); 179ReverseEndianness(MemoryMarshal.Read<uint>(source)) : 180MemoryMarshal.Read<uint>(source); 197ReverseEndianness(MemoryMarshal.Read<ulong>(source)) : 198MemoryMarshal.Read<ulong>(source); 215ReverseEndianness(MemoryMarshal.Read<UInt128>(source)) : 216MemoryMarshal.Read<UInt128>(source); 233ReverseEndianness(MemoryMarshal.Read<nuint>(source)) : 234MemoryMarshal.Read<nuint>(source); 251bool success = MemoryMarshal.TryRead(source, out long tmp); 256return MemoryMarshal.TryRead(source, out value); 273bool success = MemoryMarshal.TryRead(source, out short tmp); 278return MemoryMarshal.TryRead(source, out value); 295bool success = MemoryMarshal.TryRead(source, out short tmp); 300return MemoryMarshal.TryRead(source, out value); 317bool success = MemoryMarshal.TryRead(source, out int tmp); 322return MemoryMarshal.TryRead(source, out value); 339bool success = MemoryMarshal.TryRead(source, out long tmp); 344return MemoryMarshal.TryRead(source, out value); 361bool success = MemoryMarshal.TryRead(source, out Int128 tmp); 366return MemoryMarshal.TryRead(source, out value); 383bool success = MemoryMarshal.TryRead(source, out nint tmp); 388return MemoryMarshal.TryRead(source, out value); 404bool success = MemoryMarshal.TryRead(source, out int tmp); 409return MemoryMarshal.TryRead(source, out value); 427bool success = MemoryMarshal.TryRead(source, out ushort tmp); 432return MemoryMarshal.TryRead(source, out value); 450bool success = MemoryMarshal.TryRead(source, out uint tmp); 455return MemoryMarshal.TryRead(source, out value); 473bool success = MemoryMarshal.TryRead(source, out ulong tmp); 478return MemoryMarshal.TryRead(source, out value); 496bool success = MemoryMarshal.TryRead(source, out UInt128 tmp); 501return MemoryMarshal.TryRead(source, out value); 520bool success = MemoryMarshal.TryRead(source, out nuint tmp); 525return MemoryMarshal.TryRead(source, out value);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (52)
24BitConverter.Int64BitsToDouble(ReverseEndianness(MemoryMarshal.Read<long>(source))) : 25MemoryMarshal.Read<double>(source); 41BitConverter.Int16BitsToHalf(ReverseEndianness(MemoryMarshal.Read<short>(source))) : 42MemoryMarshal.Read<Half>(source); 58ReverseEndianness(MemoryMarshal.Read<short>(source)) : 59MemoryMarshal.Read<short>(source); 75ReverseEndianness(MemoryMarshal.Read<int>(source)) : 76MemoryMarshal.Read<int>(source); 92ReverseEndianness(MemoryMarshal.Read<long>(source)) : 93MemoryMarshal.Read<long>(source); 109ReverseEndianness(MemoryMarshal.Read<Int128>(source)) : 110MemoryMarshal.Read<Int128>(source); 126ReverseEndianness(MemoryMarshal.Read<nint>(source)) : 127MemoryMarshal.Read<nint>(source); 143BitConverter.Int32BitsToSingle(ReverseEndianness(MemoryMarshal.Read<int>(source))) : 144MemoryMarshal.Read<float>(source); 161ReverseEndianness(MemoryMarshal.Read<ushort>(source)) : 162MemoryMarshal.Read<ushort>(source); 179ReverseEndianness(MemoryMarshal.Read<uint>(source)) : 180MemoryMarshal.Read<uint>(source); 197ReverseEndianness(MemoryMarshal.Read<ulong>(source)) : 198MemoryMarshal.Read<ulong>(source); 215ReverseEndianness(MemoryMarshal.Read<UInt128>(source)) : 216MemoryMarshal.Read<UInt128>(source); 233ReverseEndianness(MemoryMarshal.Read<nuint>(source)) : 234MemoryMarshal.Read<nuint>(source); 251bool success = MemoryMarshal.TryRead(source, out long tmp); 256return MemoryMarshal.TryRead(source, out value); 273bool success = MemoryMarshal.TryRead(source, out short tmp); 278return MemoryMarshal.TryRead(source, out value); 295return MemoryMarshal.TryRead(source, out value); 298bool success = MemoryMarshal.TryRead(source, out short tmp); 317return MemoryMarshal.TryRead(source, out value); 320bool success = MemoryMarshal.TryRead(source, out int tmp); 339return MemoryMarshal.TryRead(source, out value); 342bool success = MemoryMarshal.TryRead(source, out long tmp); 361return MemoryMarshal.TryRead(source, out value); 364bool success = MemoryMarshal.TryRead(source, out Int128 tmp); 383return MemoryMarshal.TryRead(source, out value); 386bool success = MemoryMarshal.TryRead(source, out nint tmp); 404bool success = MemoryMarshal.TryRead(source, out int tmp); 409return MemoryMarshal.TryRead(source, out value); 427return MemoryMarshal.TryRead(source, out value); 430bool success = MemoryMarshal.TryRead(source, out ushort tmp); 450return MemoryMarshal.TryRead(source, out value); 453bool success = MemoryMarshal.TryRead(source, out uint tmp); 473return MemoryMarshal.TryRead(source, out value); 476bool success = MemoryMarshal.TryRead(source, out ulong tmp); 496return MemoryMarshal.TryRead(source, out value); 499bool success = MemoryMarshal.TryRead(source, out UInt128 tmp); 519return MemoryMarshal.TryRead(source, out value); 522bool success = MemoryMarshal.TryRead(source, out nuint tmp);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (16)
202ReverseEndianness<short, Int16EndiannessReverser>(MemoryMarshal.Cast<ushort, short>(source), MemoryMarshal.Cast<ushort, short>(destination)); 211ReverseEndianness<int, Int32EndiannessReverser>(MemoryMarshal.Cast<uint, int>(source), MemoryMarshal.Cast<uint, int>(destination)); 220ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.Cast<ulong, long>(source), MemoryMarshal.Cast<ulong, long>(destination)); 230ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.Cast<nuint, long>(source), MemoryMarshal.Cast<nuint, long>(destination)); 238ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.Cast<nint, long>(source), MemoryMarshal.Cast<nint, long>(destination)); 294ref T sourceRef = ref MemoryMarshal.GetReference(source); 295ref T destRef = ref MemoryMarshal.GetReference(destination); 376ReverseEndianness(MemoryMarshal.Cast<UInt128, Int128>(source), MemoryMarshal.Cast<UInt128, Int128>(destination)); 386if (Unsafe.AreSame(ref MemoryMarshal.GetReference(source), ref MemoryMarshal.GetReference(destination)) ||
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (52)
26MemoryMarshal.Write(destination, in tmp); 30MemoryMarshal.Write(destination, in value); 49MemoryMarshal.Write(destination, in tmp); 53MemoryMarshal.Write(destination, in value); 72MemoryMarshal.Write(destination, in tmp); 76MemoryMarshal.Write(destination, in value); 95MemoryMarshal.Write(destination, in tmp); 99MemoryMarshal.Write(destination, in value); 118MemoryMarshal.Write(destination, in tmp); 122MemoryMarshal.Write(destination, in value); 141MemoryMarshal.Write(destination, in tmp); 145MemoryMarshal.Write(destination, in value); 164MemoryMarshal.Write(destination, in tmp); 168MemoryMarshal.Write(destination, in value); 187MemoryMarshal.Write(destination, in tmp); 191MemoryMarshal.Write(destination, in value); 211MemoryMarshal.Write(destination, in tmp); 215MemoryMarshal.Write(destination, in value); 235MemoryMarshal.Write(destination, in tmp); 239MemoryMarshal.Write(destination, in value); 259MemoryMarshal.Write(destination, in tmp); 263MemoryMarshal.Write(destination, in value); 283MemoryMarshal.Write(destination, in tmp); 287MemoryMarshal.Write(destination, in value); 307MemoryMarshal.Write(destination, in tmp); 311MemoryMarshal.Write(destination, in value); 330return MemoryMarshal.TryWrite(destination, in tmp); 333return MemoryMarshal.TryWrite(destination, in value); 351return MemoryMarshal.TryWrite(destination, in tmp); 354return MemoryMarshal.TryWrite(destination, in value); 372return MemoryMarshal.TryWrite(destination, in tmp); 375return MemoryMarshal.TryWrite(destination, in value); 393return MemoryMarshal.TryWrite(destination, in tmp); 396return MemoryMarshal.TryWrite(destination, in value); 414return MemoryMarshal.TryWrite(destination, in tmp); 417return MemoryMarshal.TryWrite(destination, in value); 435return MemoryMarshal.TryWrite(destination, in tmp); 438return MemoryMarshal.TryWrite(destination, in value); 456return MemoryMarshal.TryWrite(destination, in tmp); 459return MemoryMarshal.TryWrite(destination, in value); 477return MemoryMarshal.TryWrite(destination, in tmp); 480return MemoryMarshal.TryWrite(destination, in value); 499return MemoryMarshal.TryWrite(destination, in tmp); 502return MemoryMarshal.TryWrite(destination, in value); 521return MemoryMarshal.TryWrite(destination, in tmp); 524return MemoryMarshal.TryWrite(destination, in value); 543return MemoryMarshal.TryWrite(destination, in tmp); 546return MemoryMarshal.TryWrite(destination, in value); 565return MemoryMarshal.TryWrite(destination, in tmp); 568return MemoryMarshal.TryWrite(destination, in value); 587return MemoryMarshal.TryWrite(destination, in tmp); 590return MemoryMarshal.TryWrite(destination, in value);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (52)
26MemoryMarshal.Write(destination, in tmp); 30MemoryMarshal.Write(destination, in value); 49MemoryMarshal.Write(destination, in tmp); 53MemoryMarshal.Write(destination, in value); 72MemoryMarshal.Write(destination, in tmp); 76MemoryMarshal.Write(destination, in value); 95MemoryMarshal.Write(destination, in tmp); 99MemoryMarshal.Write(destination, in value); 118MemoryMarshal.Write(destination, in tmp); 122MemoryMarshal.Write(destination, in value); 141MemoryMarshal.Write(destination, in tmp); 145MemoryMarshal.Write(destination, in value); 164MemoryMarshal.Write(destination, in tmp); 168MemoryMarshal.Write(destination, in value); 187MemoryMarshal.Write(destination, in tmp); 191MemoryMarshal.Write(destination, in value); 211MemoryMarshal.Write(destination, in tmp); 215MemoryMarshal.Write(destination, in value); 235MemoryMarshal.Write(destination, in tmp); 239MemoryMarshal.Write(destination, in value); 259MemoryMarshal.Write(destination, in tmp); 263MemoryMarshal.Write(destination, in value); 283MemoryMarshal.Write(destination, in tmp); 287MemoryMarshal.Write(destination, in value); 307MemoryMarshal.Write(destination, in tmp); 311MemoryMarshal.Write(destination, in value); 330return MemoryMarshal.TryWrite(destination, in tmp); 333return MemoryMarshal.TryWrite(destination, in value); 351return MemoryMarshal.TryWrite(destination, in tmp); 354return MemoryMarshal.TryWrite(destination, in value); 372return MemoryMarshal.TryWrite(destination, in tmp); 375return MemoryMarshal.TryWrite(destination, in value); 393return MemoryMarshal.TryWrite(destination, in tmp); 396return MemoryMarshal.TryWrite(destination, in value); 414return MemoryMarshal.TryWrite(destination, in tmp); 417return MemoryMarshal.TryWrite(destination, in value); 435return MemoryMarshal.TryWrite(destination, in tmp); 438return MemoryMarshal.TryWrite(destination, in value); 456return MemoryMarshal.TryWrite(destination, in tmp); 459return MemoryMarshal.TryWrite(destination, in value); 477return MemoryMarshal.TryWrite(destination, in tmp); 480return MemoryMarshal.TryWrite(destination, in value); 499return MemoryMarshal.TryWrite(destination, in tmp); 502return MemoryMarshal.TryWrite(destination, in value); 521return MemoryMarshal.TryWrite(destination, in tmp); 524return MemoryMarshal.TryWrite(destination, in value); 543return MemoryMarshal.TryWrite(destination, in tmp); 546return MemoryMarshal.TryWrite(destination, in value); 565return MemoryMarshal.TryWrite(destination, in tmp); 568return MemoryMarshal.TryWrite(destination, in value); 587return MemoryMarshal.TryWrite(destination, in tmp); 590return MemoryMarshal.TryWrite(destination, in value);
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (1)
408Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(arrays), count) = array; // arrays[count] = array, but avoiding stelemref
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64DecoderHelper.cs (5)
29fixed (T* srcBytes = &MemoryMarshal.GetReference(source)) 30fixed (byte* destBytes = &MemoryMarshal.GetReference(bytes)) 126ref sbyte decodingMap = ref MemoryMarshal.GetReference(decoder.DecodingMap); 326fixed (byte* bufferBytes = &MemoryMarshal.GetReference(buffer)) 337ref sbyte decodingMap = ref MemoryMarshal.GetReference(decoder.DecodingMap);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64EncoderHelper.cs (5)
28fixed (byte* srcBytes = &MemoryMarshal.GetReference(source)) 29fixed (T* destBytes = &MemoryMarshal.GetReference(destination)) 82ref byte encodingMap = ref MemoryMarshal.GetReference(encoder.EncodingMap); 595fixed (byte* bufferBytes = &MemoryMarshal.GetReference(buffer)) 608ref byte encodingMap = ref MemoryMarshal.GetReference(encoder.EncodingMap);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlDecoder.cs (1)
202DecodeFrom(default(Base64UrlDecoderChar), MemoryMarshal.Cast<char, ushort>(source), destination,
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlEncoder.cs (1)
108EncodeTo(default(Base64UrlEncoderChar), source, MemoryMarshal.Cast<char, ushort>(destination), out bytesConsumed, out charsWritten, isFinalBlock);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (3)
28uint index = Unsafe.Add(ref MemoryMarshal.GetReference(log2ToPow10), BitOperations.Log2(value)); 56ulong powerOf10 = Unsafe.Add(ref MemoryMarshal.GetReference(powersOf10), index); 106long tableValue = Unsafe.Add(ref MemoryMarshal.GetReference(table), uint.Log2(value));
src\libraries\System.Private.CoreLib\src\System\Byte.cs (4)
322result = Unsafe.Add(ref MemoryMarshal.GetReference(source), source.Length - sizeof(byte)); 355result = MemoryMarshal.GetReference(source); 374MemoryMarshal.GetReference(destination) = value; 392MemoryMarshal.GetReference(destination) = value;
src\libraries\System.Private.CoreLib\src\System\Char.cs (4)
1202ref byte sourceRef = ref MemoryMarshal.GetReference(source); 1252ref byte sourceRef = ref MemoryMarshal.GetReference(source); 1287Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 1305Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ArraySortHelper.cs (6)
463ref T zeroRef = ref MemoryMarshal.GetReference(keys); 549T t = Unsafe.Add(ref MemoryMarshal.GetReference(keys), i + 1); 552while (j >= 0 && (t == null || LessThan(ref t, ref Unsafe.Add(ref MemoryMarshal.GetReference(keys), j)))) 554Unsafe.Add(ref MemoryMarshal.GetReference(keys), j + 1) = Unsafe.Add(ref MemoryMarshal.GetReference(keys), j); 558Unsafe.Add(ref MemoryMarshal.GetReference(keys), j + 1) = t!;
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (2)
90ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(alternate)), 135ref MemoryMarshal.GetReference(alternate),
src\libraries\System.Private.CoreLib\src\System\Convert.Base64.cs (3)
33ref char srcChars = ref MemoryMarshal.GetReference(utf16); 34ref byte destBytes = ref MemoryMarshal.GetReference(bytes); 45ref sbyte decodingMap = ref MemoryMarshal.GetReference(DecodingMap);
src\libraries\System.Private.CoreLib\src\System\Convert.cs (5)
2368fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 2457fixed (char* outChars = &MemoryMarshal.GetReference(chars)) 2458fixed (byte* inData = &MemoryMarshal.GetReference(bytes)) 2482OperationStatus status = Base64.EncodeToUtf8(bytes, MemoryMarshal.AsBytes(chars), out _, out int bytesWritten); 2488ref ushort dest = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars));
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (4)
1150Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1168Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1194ref byte address = ref MemoryMarshal.GetReference(destination); 1223ref byte address = ref MemoryMarshal.GetReference(destination);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipePayloadDecoder.cs (5)
58decodedFields[i] = MemoryMarshal.Read<byte>(payload); 63decodedFields[i] = MemoryMarshal.Read<sbyte>(payload); 121charPayload = MemoryMarshal.Cast<byte, char>(payload); 126charPayload = MemoryMarshal.Cast<byte, char>(payload.Slice(0, byteCount - 2)); 129decodedFields[i] = BitConverter.IsLittleEndian ? new string(charPayload) : Encoding.Unicode.GetString(MemoryMarshal.Cast<char, byte>(charPayload));
src\libraries\System.Private.CoreLib\src\System\Double.cs (4)
737Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 761Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 785Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand); 809Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand);
src\libraries\System.Private.CoreLib\src\System\Enum.cs (2)
2253ReadOnlySpan<byte> rawData = MemoryMarshal.AsBytes(new ReadOnlySpan<long>(ref value)); 2264return RuntimeHelpers.Box(ref MemoryMarshal.GetReference(rawData), type)!;
src\libraries\System.Private.CoreLib\src\System\Enum.EnumInfo.cs (1)
39return MemoryMarshal.Cast<TStorage, TResult>(Values).ToArray();
src\libraries\System.Private.CoreLib\src\System\Environment.Variables.Windows.cs (2)
37uint length = Interop.Kernel32.GetEnvironmentVariable(variable, ref MemoryMarshal.GetReference(span), (uint)span.Length); 97ReadOnlySpan<char> variable = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(currentPtr);
src\libraries\System.Private.CoreLib\src\System\GCMemoryInfo.cs (2)
80internal ReadOnlySpan<GCGenerationInfo> GenerationInfoAsSpan => MemoryMarshal.CreateReadOnlySpan(ref _generationInfo0, 5); 85internal ReadOnlySpan<TimeSpan> PauseDurationsAsSpan => MemoryMarshal.CreateReadOnlySpan(ref _pauseDuration0, 2);
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (1)
444ReadOnlySpan<char> calendarStringSpan = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(calendarStringPtr);
src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (17)
88StrongBidiCategory bidiCategory = (StrongBidiCategory)(Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoriesValues), offset) & 0b_0110_0000); 124uint rawValue = Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(DigitValues), offset); 158int rawValue = Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(DigitValues), offset); 172return (GraphemeClusterBreakType)Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(GraphemeSegmentationValues), offset); 190return (sbyte)Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoriesValues), offset) < 0; 236ref byte refToValue = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericValues), offset * 8 /* sizeof(double) */); 260ref short rsStart = ref Unsafe.As<byte, short>(ref MemoryMarshal.GetReference(UppercaseValues)); 279ref ushort rsStart = ref Unsafe.As<byte, ushort>(ref MemoryMarshal.GetReference(UppercaseValues)); 295ref short rsStart = ref Unsafe.As<byte, short>(ref MemoryMarshal.GetReference(LowercaseValues)); 314ref ushort rsStart = ref Unsafe.As<byte, ushort>(ref MemoryMarshal.GetReference(LowercaseValues)); 394return (UnicodeCategory)(Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoriesValues), offset) & 0x1F); 455uint index = Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoryCasingLevel1Index), codePoint >> 9); 461ref byte level2Ref = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoryCasingLevel2Index), (index << 6) + ((codePoint >> 3) & 0b_0011_1110)); 475return Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoryCasingLevel3Index), (index << 4) + (codePoint & 0x0F)); 492uint index = Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericGraphemeLevel1Index), codePoint >> 9); 498ref byte level2Ref = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericGraphemeLevel2Index), (index << 6) + ((codePoint >> 3) & 0b_0011_1110)); 512return Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericGraphemeLevel3Index), (index << 4) + (codePoint & 0x0F));
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.cs (8)
290InvariantModeCasing.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(string1), string1.Length, ref MemoryMarshal.GetReference(string2), string2.Length) : 366Debug.Assert(!Unsafe.IsNullRef(ref MemoryMarshal.GetReference(span1))); 367Debug.Assert(!Unsafe.IsNullRef(ref MemoryMarshal.GetReference(span2))); 437return Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(string1), string1.Length, ref MemoryMarshal.GetReference(string2), string2.Length); 451return Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(string1), string1.Length, ref MemoryMarshal.GetReference(string2), string2.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (26)
59fixed (char* pString1 = &MemoryMarshal.GetReference(string1)) 60fixed (char* pString2 = &MemoryMarshal.GetReference(string2)) 84fixed (char* pSource = &MemoryMarshal.GetReference(source)) 85fixed (char* pTarget = &MemoryMarshal.GetReference(target)) 111fixed (char* ap = &MemoryMarshal.GetReference(source)) 112fixed (char* bp = &MemoryMarshal.GetReference(target)) 237fixed (char* ap = &MemoryMarshal.GetReference(source)) 238fixed (char* bp = &MemoryMarshal.GetReference(target)) 353fixed (char* pSource = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced) 354fixed (char* pPrefix = &MemoryMarshal.GetReference(prefix)) 374fixed (char* ap = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced) 375fixed (char* bp = &MemoryMarshal.GetReference(prefix)) 456fixed (char* ap = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced) 457fixed (char* bp = &MemoryMarshal.GetReference(prefix)) 537fixed (char* pSource = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced) 538fixed (char* pSuffix = &MemoryMarshal.GetReference(suffix)) 558fixed (char* ap = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced) 559fixed (char* bp = &MemoryMarshal.GetReference(suffix)) 641fixed (char* ap = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced) 642fixed (char* bp = &MemoryMarshal.GetReference(suffix)) 785fixed (char* pSource = &MemoryMarshal.GetReference(source)) 786fixed (byte* pDest = &MemoryMarshal.GetReference(destination)) 834fixed (char* pSource = &MemoryMarshal.GetReference(source)) 906fixed (char* pSource = &MemoryMarshal.GetNonNullPinnableReference(source)) 908fixed (byte* pSortKey = &MemoryMarshal.GetReference(sortKey)) 931fixed (byte* pSortKey = &MemoryMarshal.GetReference(sortKey))
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (12)
54fixed (char* pSource = &MemoryMarshal.GetReference(source)) 55fixed (char* pValue = &MemoryMarshal.GetReference(value)) 138fixed (char* pSource = &MemoryMarshal.GetReference(source)) 160fixed (byte* pSortKey = &MemoryMarshal.GetReference(span)) 231fixed (char* pString1 = &MemoryMarshal.GetReference(string1)) 232fixed (char* pString2 = &MemoryMarshal.GetReference(string2)) 283fixed (char* pSource = &MemoryMarshal.GetReference(lpStringSource)) 284fixed (char* pValue = &MemoryMarshal.GetReference(lpStringValue)) 464fixed (char* pSource = &MemoryMarshal.GetReference(source)) 465fixed (byte* pSortKey = &MemoryMarshal.GetReference(destination)) 543fixed (char* pSource = &MemoryMarshal.GetReference(source)) 572fixed (char* pText = &MemoryMarshal.GetReference(text))
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (17)
176fixed (TChar* ptr = &MemoryMarshal.GetReference(outputBuffer.AppendSpan(2))) 183fixed (TChar* ptr = &MemoryMarshal.GetReference(outputBuffer.AppendSpan(4))) 757r.EncodeToUtf8(MemoryMarshal.AsBytes(result.AppendSpan(r.Utf8SequenceLength))); 834fixed (TChar* p = &MemoryMarshal.GetReference(result.AppendSpan(2))) 842fixed (TChar* p = &MemoryMarshal.GetReference(result.AppendSpan(5))) 888fixed (TChar* hoursMinutes = &MemoryMarshal.GetReference(result.AppendSpan(5))) 1115bool success = Unsafe.AreSame(ref MemoryMarshal.GetReference(destination), ref MemoryMarshal.GetReference(vlb.AsSpan())); 1326fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1353fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1379fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1412fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1472fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1532fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1572fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1620fixed (TChar* dest = &MemoryMarshal.GetReference(destination)) 1679fixed (TChar* dest = &MemoryMarshal.GetReference(destination))
src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewNumber.cs (1)
214Rune.DecodeLastFromUtf8(MemoryMarshal.AsBytes(outputBuffer.AsSpan()), out Rune value, out int bytesConsumed);
src\libraries\System.Private.CoreLib\src\System\Globalization\InvariantModeCasing.cs (4)
230fixed (char* pSource = &MemoryMarshal.GetReference(source)) 231fixed (char* pValue = &MemoryMarshal.GetReference(value)) 292fixed (char* pSource = &MemoryMarshal.GetReference(source)) 293fixed (char* pValue = &MemoryMarshal.GetReference(value))
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (1)
63fixed (char* pDest = &MemoryMarshal.GetReference(buffer))
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (1)
83fixed (char* pDest = &MemoryMarshal.GetReference(buffer))
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (2)
355ref char valueRef = ref MemoryMarshal.GetReference(value); 365ref char searchSpace = ref MemoryMarshal.GetReference(source);
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.Utf8.cs (4)
61ReadOnlySpan<byte> spanA = MemoryMarshal.CreateReadOnlySpan(ref strA, lengthA); 62ReadOnlySpan<byte> spanB = MemoryMarshal.CreateReadOnlySpan(ref strB, lengthB); 371ReadOnlySpan<byte> spanA = MemoryMarshal.CreateReadOnlySpan(ref source, sourceLength); 372ReadOnlySpan<byte> spanB = MemoryMarshal.CreateReadOnlySpan(ref prefix, prefixLength);
src\libraries\System.Private.CoreLib\src\System\Globalization\OrdinalCasing.Icu.cs (4)
296fixed (char* pSource = &MemoryMarshal.GetReference(source)) 297fixed (char* pValue = &MemoryMarshal.GetReference(value)) 360fixed (char* pSource = &MemoryMarshal.GetReference(source)) 361fixed (char* pValue = &MemoryMarshal.GetReference(value))
src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.cs (2)
267fixed (char* pSource = &MemoryMarshal.GetReference(source)) 268fixed (char* pDestination = &MemoryMarshal.GetReference(destination))
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (1)
232fixed (TChar* dest = &MemoryMarshal.GetReference(destination))
src\libraries\System.Private.CoreLib\src\System\Guid.cs (18)
70this = MemoryMarshal.Read<Guid>(b); 87this = MemoryMarshal.Read<Guid>(b); 507Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result)); 593Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result)); 917MemoryMarshal.TryWrite(g, in this); 922Guid guid = new Guid(MemoryMarshal.AsBytes(new ReadOnlySpan<Guid>(in this)), false); 923MemoryMarshal.TryWrite(g, in guid); 935MemoryMarshal.TryWrite(g, in this); 940Guid guid = new Guid(MemoryMarshal.AsBytes(new ReadOnlySpan<Guid>(in this)), bigEndian); 941MemoryMarshal.TryWrite(g, in guid); 954MemoryMarshal.TryWrite(destination, in this); 959Guid guid = new Guid(MemoryMarshal.AsBytes(new ReadOnlySpan<Guid>(in this)), false); 960MemoryMarshal.TryWrite(destination, in guid); 976MemoryMarshal.TryWrite(destination, in this); 981Guid guid = new Guid(MemoryMarshal.AsBytes(new ReadOnlySpan<Guid>(in this)), bigEndian); 982MemoryMarshal.TryWrite(destination, in guid); 1269fixed (TChar* guidChars = &MemoryMarshal.GetReference(destination)) 1391fixed (TChar* guidChars = &MemoryMarshal.GetReference(destination))
src\libraries\System.Private.CoreLib\src\System\Half.cs (4)
1373Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1391Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1415Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand); 1439Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand);
src\libraries\System.Private.CoreLib\src\System\HashCode.cs (1)
320ref byte pos = ref MemoryMarshal.GetReference(value);
src\libraries\System.Private.CoreLib\src\System\Int128.cs (4)
800ref byte sourceRef = ref MemoryMarshal.GetReference(source); 882ref byte sourceRef = ref MemoryMarshal.GetReference(source); 954ref byte address = ref MemoryMarshal.GetReference(destination); 983ref byte address = ref MemoryMarshal.GetReference(destination);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (4)
344ref byte sourceRef = ref MemoryMarshal.GetReference(source); 419ref byte sourceRef = ref MemoryMarshal.GetReference(source); 471Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 489Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (4)
364ref byte sourceRef = ref MemoryMarshal.GetReference(source); 446ref byte sourceRef = ref MemoryMarshal.GetReference(source); 510Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 528Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\Int64.cs (4)
361ref byte sourceRef = ref MemoryMarshal.GetReference(source); 443ref byte sourceRef = ref MemoryMarshal.GetReference(source); 507Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 525Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (4)
366ref byte sourceRef = ref MemoryMarshal.GetReference(source); 448ref byte sourceRef = ref MemoryMarshal.GetReference(source); 517Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 540Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEntry.Unix.cs (1)
98Span<char> buffer = MemoryMarshal.CreateSpan(ref _fileNameBuffer._buffer[0], Interop.Sys.DirectoryEntry.NameBufferSize);
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (2)
412MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> destinationArray) ? 696if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> sourceArray))
src\libraries\System.Private.CoreLib\src\System\IO\PinnedBufferMemoryStream.cs (1)
26fixed (byte* ptr = &MemoryMarshal.GetReference((Span<byte>)array))
src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (4)
27fixed (byte* bufPtr = &MemoryMarshal.GetReference(buffer)) 78fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(vectors)) 104fixed (byte* bufPtr = &MemoryMarshal.GetReference(buffer)) 199fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(vectors))
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (2)
310if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array)) 732if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array))
src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (1)
424fixed (char* bufferPtr = &MemoryMarshal.GetReference(buffer))
src\libraries\System.Private.CoreLib\src\System\IO\TextReader.cs (2)
275new ValueTask<int>(MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ? 305new ValueTask<int>(MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ?
src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (2)
593MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ? 657MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ?
src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryStream.cs (6)
393SpanHelpers.Memmove(ref MemoryMarshal.GetReference(buffer), ref *(pointer + pos + _offset), (nuint)nInt); 405SpanHelpers.Memmove(ref MemoryMarshal.GetReference(buffer), ref *(_mem + pos), (nuint)nInt); 467MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> destinationArray) ? 672SpanHelpers.Memmove(ref *(pointer + pos + _offset), ref MemoryMarshal.GetReference(buffer), (nuint)buffer.Length); 684SpanHelpers.Memmove(ref *(_mem + pos), ref MemoryMarshal.GetReference(buffer), (nuint)buffer.Length); 733if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> sourceArray))
src\libraries\System.Private.CoreLib\src\System\Marvin.cs (1)
17public static int ComputeHash32(ReadOnlySpan<byte> data, ulong seed) => ComputeHash32(ref MemoryMarshal.GetReference(data), (uint)data.Length, (uint)seed, (uint)(seed >> 32));
src\libraries\System.Private.CoreLib\src\System\Marvin.OrdinalIgnoreCase.cs (1)
93int hash = ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(scratch)), (uint)charsWritten * 2, p0, p1);
src\libraries\System.Private.CoreLib\src\System\Memory.cs (4)
307refToReturn = ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject)); 320refToReturn = ref MemoryMarshal.GetReference(memoryManagerSpan); 415void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject))), _index & ReadOnlyMemory<T>.RemoveFlagsBitMask); 422void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject))), _index);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (210)
38return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), array.Length - start); 62return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)actualIndex /* force zero-extension */), array.Length - actualIndex); 86return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), length); 323ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 330ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 337ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 344ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 350return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length); 367ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 374ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 381ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 388ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 394return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length); 623ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 629ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 635ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 641ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 646return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 661ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 663ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 668ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 670ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 674return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 690ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 697ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 704ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 711ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 717return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 733ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 735ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 741ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 743ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 748return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 826ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 833ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 840ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 847ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 853return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length); 873ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 881ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 888return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 909ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 918ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 926return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 937ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 947ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 956return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length); 994ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 997ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1007ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 1010ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1023ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1025ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)), 1135ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1142ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1149ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1156ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1162return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length); 1182ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1190ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1197return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 1218ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1227ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1235return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 1246ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1256ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1265return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length); 1304ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 1307ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1317ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 1320ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1333ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1335ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)), 1399ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1408ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1417ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1426ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1433return SpanHelpers.IndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 1465ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1474ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1483ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1492ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1499return SpanHelpers.IndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 1531ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1540ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1549ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1558ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1565return SpanHelpers.LastIndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 1597ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1606ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1615ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1624ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1631return SpanHelpers.LastIndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length); 1656ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1657ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 1661return length == otherLength && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other), length); 1675ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1677ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 1682ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1684ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)), 1687return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length); 1702ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1708ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1714ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1720ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1725return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 1740ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1742ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 1747ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1749ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 1753return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 1769ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1776ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1783ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1790ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1796return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 1812ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1814ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 1820ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1822ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 1827return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 1844ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1852ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1859return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 1877ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1886ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1894return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 1938ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1946ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1953return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 1971ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1980ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1988return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 2003ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 2004ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 2051ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)); 2052ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 2088return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length); 2139ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2147ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2154return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 2172ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2181ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2189return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 2224ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2232ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2239return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 2257ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2266ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2274return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 2289ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 2290ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 2337ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)); 2338ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 2374return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length); 2407ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2408ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 2412return length == otherLength && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other), length); 2448ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2449ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 2491ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2493ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 2498ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 2500ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)), 2503return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length); 2518ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2519ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2523return valueLength <= span.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), valueLength); 2538ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2539ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2543return valueLength <= span.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), valueLength); 2559ref Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */)), 2560ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2566ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */), 2567ref MemoryMarshal.GetReference(value), 2584ref Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */)), 2585ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2591ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */), 2592ref MemoryMarshal.GetReference(value), 2625SpanHelpers.Reverse(ref MemoryMarshal.GetReference(span), (nuint)span.Length); 3038ref MemoryMarshal.GetReference(span), 3039ref MemoryMarshal.GetReference(other)); 3057ref MemoryMarshal.GetReference(span), 3058ref MemoryMarshal.GetReference(other)); 3377ref byte src = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 3389ref ushort src = ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)); 3400ref int src = ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)); 3411ref long src = ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)); 3422ref T src2 = ref MemoryMarshal.GetReference(span); 3450ref T src = ref MemoryMarshal.GetReference(source); 3451ref T dst = ref MemoryMarshal.GetReference(destination); 3538ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3539ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 4031ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 4038ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 4045ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 4052ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 4059ref MemoryMarshal.GetReference(span),
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.cs (12)
86return Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), span.Length); 117return Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length); 133return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 165ref MemoryMarshal.GetReference(span), 167ref MemoryMarshal.GetReference(value), 325ref Unsafe.Add(ref MemoryMarshal.GetReference(span), span.Length - value.Length), 326ref MemoryMarshal.GetReference(value), 362&& Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), value.Length);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.Utf8.cs (4)
24return Ordinal.EqualsIgnoreCaseUtf8(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 75return Ordinal.StartsWithIgnoreCaseUtf8(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (1)
349Span<byte> utf8Bytes = MemoryMarshal.AsBytes(dest).Slice(dest.Length * 2 - state.byteCount);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (17)
276MemoryMarshal.AsBytes<char>("00010203040506070809" + 1425fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 1473fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 1529fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 1582ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(typeof(TChar) == typeof(char) ? TwoDigitsCharsAsBytes : TwoDigitsBytes), (uint)sizeof(TChar) * 2 * value), 1598ref byte charsArray = ref MemoryMarshal.GetArrayDataReference(typeof(TChar) == typeof(char) ? TwoDigitsCharsAsBytes : TwoDigitsBytes); 1739fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 1760fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 1858fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 1906fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 1978fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 2167fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 2187fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 2288fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 2340fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 2403fixed (TChar* buffer = &MemoryMarshal.GetReference(destination)) 2528fixed (TChar* buffer = &MemoryMarshal.GetReference(destination))
src\libraries\System.Private.CoreLib\src\System\Numerics\BitOperations.cs (5)
395ref MemoryMarshal.GetReference(Log2DeBruijn), 578ref MemoryMarshal.GetReference(TrailingZeroCountDeBruijn), 875ref uint lookupTable = ref MemoryMarshal.GetArrayDataReference(s_crcTable); 883ref uint lookupTable = ref MemoryMarshal.GetArrayDataReference(s_crcTable); 894ref uint lookupTable = ref MemoryMarshal.GetArrayDataReference(s_crcTable);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector.cs (1)
644return Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector_1.cs (6)
97this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 115this = Unsafe.ReadUnaligned<Vector<T>>(ref MemoryMarshal.GetReference(values)); 675Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this); 689Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this); 796Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this); 811Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (3)
311return Unsafe.ReadUnaligned<Vector2>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values))); 659Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 673Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (3)
346return Unsafe.ReadUnaligned<Vector3>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values))); 692Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 706Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Random.cs (1)
352Shuffle(new Span<T>(ref MemoryMarshal.GetArrayDataReference(values), values.Length));
src\libraries\System.Private.CoreLib\src\System\Random.Xoshiro256StarStarImpl.cs (1)
143ref MemoryMarshal.GetReference(buffer),
src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (4)
229refToReturn = ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject)); 242refToReturn = ref MemoryMarshal.GetReference(memoryManagerSpan); 330void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject))), _index & RemoveFlagsBitMask); 337void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject))), _index);
src\libraries\System.Private.CoreLib\src\System\ReadOnlySpan.cs (3)
47_reference = ref MemoryMarshal.GetArrayDataReference(array); 81_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 399Buffer.Memmove(ref MemoryMarshal.GetArrayDataReference(destination), ref _reference, (uint)_length);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\RuntimeHelpers.cs (2)
63ref MemoryMarshal.GetArrayDataReference(dest), 64ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), offset),
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\CollectionsMarshal.cs (1)
38span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(items), size);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\GCHandle.cs (1)
139return (IntPtr)Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<Array>(target)));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (2)
169void* pRawData = Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(arr)); 178void* pRawData = Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(arr));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\AnsiStringMarshaller.cs (1)
91_unmanagedValue = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ArrayMarshaller.cs (2)
170public ref TUnmanagedElement GetPinnableReference() => ref MemoryMarshal.GetReference(_span); 201return ref MemoryMarshal.GetArrayDataReference(array);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\BStrStringMarshaller.cs (1)
90byte* pBuffer = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\PointerArrayMarshaller.cs (2)
171public ref TUnmanagedElement GetPinnableReference() => ref MemoryMarshal.GetReference(_span); 202return ref MemoryMarshal.GetArrayDataReference(array);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (5)
18/// A <see cref="ReadOnlySpan{T}"/> marshalled with this marshaller will match the semantics of <see cref="MemoryMarshal.GetReference{T}(ReadOnlySpan{T})"/>. 44if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 104if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 141public ref TUnmanagedElement GetPinnableReference() => ref MemoryMarshal.GetReference(_span); 167return ref MemoryMarshal.GetReference(managed);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (5)
18/// A <see cref="Span{T}"/> marshalled with this marshaller will match the semantics of <see cref="MemoryMarshal.GetReference{T}(Span{T})"/>. 38if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 132if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 168public ref TUnmanagedElement GetPinnableReference() => ref MemoryMarshal.GetReference(_span); 194return ref MemoryMarshal.GetReference(managed);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\Utf8StringMarshaller.cs (1)
95_unmanagedValue = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(buffer));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (4)
1052Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1076Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1100Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand); 1124Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeBuffer.cs (2)
246ref T structure = ref MemoryMarshal.GetReference(buffer); 335ref T structure = ref MemoryMarshal.GetReference(data);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\ISimdVector_2.cs (3)
180TSelf.StoreUnsafe(vector, ref MemoryMarshal.GetReference(destination)); 217return TSelf.LoadUnsafe(ref MemoryMarshal.GetReference(values)); 660TSelf.StoreUnsafe(vector, ref MemoryMarshal.GetReference(destination));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (3)
824Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 1022return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 3512Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (3)
663Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 861return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 3377Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (3)
589Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 778return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 3370Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (3)
607Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 819return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 3397Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
src\libraries\System.Private.CoreLib\src\System\SByte.cs (4)
348result = (sbyte)Unsafe.Add(ref MemoryMarshal.GetReference(source), source.Length - sizeof(sbyte)); 401result = (sbyte)MemoryMarshal.GetReference(source); 432Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 450Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1CharPackedIgnoreCaseSearchValues.cs (2)
37PackedSpanHelpers.IndexOfAnyIgnoreCase(ref MemoryMarshal.GetReference(span), _lowerCase, span.Length); 42PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref MemoryMarshal.GetReference(span), _lowerCase, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1CharPackedSearchValues.cs (2)
27PackedSpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), _e0, span.Length); 32PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 40SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 44SpanHelpers.LastIndexOfValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2CharPackedIgnoreCaseSearchValues.cs (4)
44PackedSpanHelpers.IndexOfAnyIgnoreCase(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length); 49PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length); 57ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 65ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2CharPackedSearchValues.cs (2)
27PackedSpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length); 32PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3CharPackedSearchValues.cs (2)
27PackedSpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), _e0, _e1, _e2, span.Length); 32PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, _e1, _e2, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any4SearchValues.cs (4)
39SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 43SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 47SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 51SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any5SearchValues.cs (4)
40SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 44SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 48SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 52SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AnyByteSearchValues.cs (6)
32ref MemoryMarshal.GetReference(span), span.Length, ref _state); 40ref MemoryMarshal.GetReference(span), span.Length, ref _state); 48ref MemoryMarshal.GetReference(span), span.Length, ref _state); 56ref MemoryMarshal.GetReference(span), span.Length, ref _state); 64ref MemoryMarshal.GetReference(span), span.Length, ref _state); 72ref MemoryMarshal.GetReference(span), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiByteSearchValues.cs (6)
48ref MemoryMarshal.GetReference(span), span.Length, ref _state); 56ref MemoryMarshal.GetReference(span), span.Length, ref _state); 64ref MemoryMarshal.GetReference(span), span.Length, ref _state); 72ref MemoryMarshal.GetReference(span), span.Length, ref _state); 80ref MemoryMarshal.GetReference(span), span.Length, ref _state); 88ref MemoryMarshal.GetReference(span), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiCharSearchValues.cs (6)
49ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 57ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 65ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 73ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 81ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 89ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\BitmapCharSearchValues.cs (4)
56IndexOfAny<IndexOfAnyAsciiSearcher.DontNegate>(ref MemoryMarshal.GetReference(span), span.Length); 60IndexOfAny<IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length); 64LastIndexOfAny<IndexOfAnyAsciiSearcher.DontNegate>(ref MemoryMarshal.GetReference(span), span.Length); 68LastIndexOfAny<IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticCharSearchValues.cs (4)
26ProbabilisticMap.IndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, ref _map); 29ProbabilisticMapState.IndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length, ref _map); 32ProbabilisticMap.LastIndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, ref _map); 35ProbabilisticMapState.LastIndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length, ref _map);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (1)
102ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(values)),
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (1)
88return Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(hashEntries), (nuint)offset) == value;
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticWithAsciiCharSearchValues.cs (10)
60ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 70ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 86ref MemoryMarshal.GetReference(span), 109ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 124ref MemoryMarshal.GetReference(span), 159ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 169ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 185ref MemoryMarshal.GetReference(span), 198ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 213ref MemoryMarshal.GetReference(span),
src\libraries\System.Private.CoreLib\src\System\SearchValues\RangeCharSearchValues.cs (4)
43? PackedSpanHelpers.IndexOfAnyInRange(ref MemoryMarshal.GetReference(span), _lowInclusive, _rangeInclusive, span.Length) 45ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(span)), 53? PackedSpanHelpers.IndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), _lowInclusive, _rangeInclusive, span.Length) 55ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(span)),
src\libraries\System.Private.CoreLib\src\System\SearchValues\SearchValues.cs (1)
84ReadOnlySpan<short> shortValues = MemoryMarshal.Cast<char, short>(values);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\AsciiStringSearchValuesTeddyBase.cs (9)
202ref char searchSpace = ref MemoryMarshal.GetReference(span); 254ref char searchSpace = ref MemoryMarshal.GetReference(span); 306ref char searchSpace = ref MemoryMarshal.GetReference(span); 361ref char searchSpace = ref MemoryMarshal.GetReference(span); 431ref char searchSpace = ref MemoryMarshal.GetReference(span); 486ref char searchSpace = ref MemoryMarshal.GetReference(span); 547offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref matchRef) / 2); 594offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref matchRef) / 2); 639offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref matchRef) / 2);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasick.cs (7)
81ref AhoCorasickNode nodes = ref MemoryMarshal.GetArrayDataReference(_nodes); 100ref Unsafe.As<char, short>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), i)), 123char c = TCaseSensitivity.TransformInput(Unsafe.Add(ref MemoryMarshal.GetReference(span), i)); 186ref AhoCorasickNode nodes = ref MemoryMarshal.GetArrayDataReference(_nodes); 209ref Unsafe.As<char, short>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), i)), 242c = Unsafe.Add(ref MemoryMarshal.GetReference(span), i); 247char.IsLowSurrogate(lowSurrogate = Unsafe.Add(ref MemoryMarshal.GetReference(span), i + 1)))
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (4)
114ref char current = ref MemoryMarshal.GetReference(span); 120ref char end = ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (uint)(span.Length - hashLength)); 129ref string[]? bucketsRef = ref MemoryMarshal.GetArrayDataReference(_buckets); 137int startOffset = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref current) / sizeof(char));
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\StringSearchValuesHelper.cs (2)
22ValidateReadPosition(MemoryMarshal.CreateReadOnlySpan(ref searchSpaceStart, searchSpaceLength), ref searchSpace, offset); 30nint currentByteOffset = Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref searchSpace);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (1)
64IndexOf(ref MemoryMarshal.GetReference(span), span.Length);
src\libraries\System.Private.CoreLib\src\System\Single.cs (4)
726Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 744Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 768Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand); 792Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand);
src\libraries\System.Private.CoreLib\src\System\Span.cs (3)
49_reference = ref MemoryMarshal.GetArrayDataReference(array); 86_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 429Buffer.Memmove(ref MemoryMarshal.GetArrayDataReference(destination), ref _reference, (uint)_length);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.BinarySearch.cs (1)
20return BinarySearch(ref MemoryMarshal.GetReference(span), span.Length, comparable);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (6)
456=> SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(strA), strA.Length, ref MemoryMarshal.GetReference(strB), strB.Length); 779return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)); 812return Marvin.ComputeHash32OrdinalIgnoreCase(ref MemoryMarshal.GetReference(value), value.Length /* in chars, not bytes */, (uint)seed, (uint)(seed >> 32)); 866fixed (char* src = &MemoryMarshal.GetReference(span)) 977fixed (char* src = &MemoryMarshal.GetReference(span))
src\libraries\System.Private.CoreLib\src\System\String.cs (6)
87source: ref MemoryMarshal.GetArrayDataReference(value)); 113source: ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(value), startIndex)); 318Buffer.Memmove(ref result._firstChar, ref MemoryMarshal.GetReference(value), (uint)value.Length); 428destination: ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(destination), destinationIndex), 473destination: ref MemoryMarshal.GetArrayDataReference(chars), 497destination: ref MemoryMarshal.GetArrayDataReference(chars),
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (3)
2044ref char source = ref MemoryMarshal.GetReference(sourceSpan); 2379fixed (char* pTrimChars = &MemoryMarshal.GetReference(trimChars)) 2420fixed (char* pTrimChars = &MemoryMarshal.GetReference(trimChars))
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.CaseConversion.cs (15)
41=> ChangeCase<ushort, ushort, ToUpperConversion>(MemoryMarshal.Cast<char, ushort>(source), MemoryMarshal.Cast<char, ushort>(destination), out charsWritten); 53=> ChangeCase<byte, ushort, ToUpperConversion>(source, MemoryMarshal.Cast<char, ushort>(destination), out charsWritten); 65=> ChangeCase<ushort, byte, ToUpperConversion>(MemoryMarshal.Cast<char, ushort>(source), destination, out bytesWritten); 91=> ChangeCase<ushort, ushort, ToLowerConversion>(MemoryMarshal.Cast<char, ushort>(source), MemoryMarshal.Cast<char, ushort>(destination), out charsWritten); 103=> ChangeCase<byte, ushort, ToLowerConversion>(source, MemoryMarshal.Cast<char, ushort>(destination), out charsWritten); 115=> ChangeCase<ushort, byte, ToLowerConversion>(MemoryMarshal.Cast<char, ushort>(source), destination, out bytesWritten); 135=> ChangeCase<ushort, ToLowerConversion>(MemoryMarshal.Cast<char, ushort>(value), out charsWritten); 155=> ChangeCase<ushort, ToUpperConversion>(MemoryMarshal.Cast<char, ushort>(value), out charsWritten); 162if (MemoryMarshal.AsBytes(source).Overlaps(MemoryMarshal.AsBytes(destination))) 181fixed (TFrom* pSource = &MemoryMarshal.GetReference(source)) 182fixed (TTo* pDestination = &MemoryMarshal.GetReference(destination)) 196fixed (T* pBuffer = &MemoryMarshal.GetReference(buffer))
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.cs (2)
22IsValidCore(ref MemoryMarshal.GetReference(value), value.Length); 32IsValidCore(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(value)), value.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Equality.cs (12)
25&& Equals<byte, byte, PlainLoader<byte>>(ref MemoryMarshal.GetReference(left), ref MemoryMarshal.GetReference(right), (uint)right.Length); 30&& Equals<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 39&& Equals<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 176&& EqualsIgnoreCase<byte, byte, PlainLoader<byte>>(ref MemoryMarshal.GetReference(left), ref MemoryMarshal.GetReference(right), (uint)right.Length); 181&& EqualsIgnoreCase<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 190&& EqualsIgnoreCase<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Transcoding.cs (4)
36fixed (byte* pSource = &MemoryMarshal.GetReference(source)) 37fixed (char* pDestination = &MemoryMarshal.GetReference(destination)) 71fixed (char* pSource = &MemoryMarshal.GetReference(source)) 72fixed (byte* pDestination = &MemoryMarshal.GetReference(destination))
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (10)
144fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 318fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 319fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 328fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 329fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 486fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 609fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 610fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 619fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 620fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
src\libraries\System.Private.CoreLib\src\System\Text\Decoder.cs (5)
112fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes)) 198fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes)) 199fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars)) 304fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes)) 305fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars))
src\libraries\System.Private.CoreLib\src\System\Text\DecoderNLS.cs (7)
61fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 106fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 107fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars)) 157fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 158fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars)) 206MemoryMarshal.AsBytes(new ReadOnlySpan<int>(in _leftoverBytes)).Slice(0, _leftoverByteCount); 210bytes.CopyTo(MemoryMarshal.AsBytes(new Span<int>(ref _leftoverBytes)));
src\libraries\System.Private.CoreLib\src\System\Text\Encoder.cs (5)
110fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars)) 195fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars)) 196fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes)) 303fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars)) 304fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes))
src\libraries\System.Private.CoreLib\src\System\Text\EncoderNLS.cs (5)
57fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars)) 96fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars)) 97fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 143fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars)) 144fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes))
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (7)
583fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars)) 729fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars)) 730fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes)) 785fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes)) 878fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes)) 879fixed (char* charsPtr = &MemoryMarshal.GetNonNullPinnableReference(chars)) 915fixed (byte* bytesPtr = &MemoryMarshal.GetNonNullPinnableReference(bytes))
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (18)
272pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)), 317fixed (char* _pChars_Unused = &MemoryMarshal.GetReference(chars)) 365pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)), 549pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)), 551pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 594fixed (char* _pChars_Unused = &MemoryMarshal.GetReference(chars)) 595fixed (byte* _pBytes_Unused = &MemoryMarshal.GetReference(bytes)) 652pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)), 654pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 872pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 917fixed (byte* _pBytes_Unused = &MemoryMarshal.GetReference(bytes)) 961pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 1152pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 1154pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)), 1195fixed (byte* _pBytes_Unused = &MemoryMarshal.GetReference(bytes)) 1196fixed (char* _pChars_Unused = &MemoryMarshal.GetReference(chars)) 1252pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 1254pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)),
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (9)
83fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 230fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 231fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 240fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 241fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 525fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 526fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 537fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 538fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (8)
341ref MemoryMarshal.GetArrayDataReference(sourceArray), 963ReplaceInPlaceAtChunk(ref chunk!, ref indexInChunk, ref MemoryMarshal.GetReference(value), value.Length); 1088Append(ref MemoryMarshal.GetArrayDataReference(value), value.Length); 1096Append(ref MemoryMarshal.GetReference(value), value.Length); 1339Insert(index, ref MemoryMarshal.GetArrayDataReference(value), value.Length); 1406Insert(index, ref MemoryMarshal.GetReference(value), value.Length); 2277ref char destination = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(chunkChars), chunkLength); 2383ReplaceInPlaceAtChunk(ref targetChunk!, ref targetIndexInChunk, ref MemoryMarshal.GetReference<char>(value), value.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (25)
49fixed (char* pOriginalSource = &MemoryMarshal.GetReference(source)) 50fixed (byte* pOriginalDestination = &MemoryMarshal.GetReference(destination)) 65pInputBuffer: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)), 67pOutputBuffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)), 95destination = destination.Slice((int)(pOutputBufferRemaining - (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)))); 110source = source.Slice((int)(pInputBufferRemaining - (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source))) + 1); 113pInputBufferRemaining = (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)); 114pOutputBufferRemaining = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)); 140fixed (byte* pOriginalSource = &MemoryMarshal.GetReference(source)) 141fixed (char* pOriginalDestination = &MemoryMarshal.GetReference(destination)) 156pInputBuffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)), 158pOutputBuffer: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)), 186destination = destination.Slice((int)(pOutputBufferRemaining - (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)))); 200source = source.Slice((int)(pInputBufferRemaining - (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)))); 207pInputBufferRemaining = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)); 208pOutputBufferRemaining = (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)); 234fixed (byte* pOriginalSource = &MemoryMarshal.GetReference(source)) 235fixed (char* pOriginalDestination = &MemoryMarshal.GetReference(destination)) 250pInputBuffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)), 252pOutputBuffer: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)), 284source = source.Slice((int)(pInputBufferRemaining - (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)))); 285destination = destination.Slice((int)(pOutputBufferRemaining - (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)))); 306pInputBufferRemaining = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(source)); 307pOutputBufferRemaining = (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(destination)); 409ref MemoryMarshal.GetReference(dest), dest.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.cs (1)
28fixed (byte* pUtf8Data = &MemoryMarshal.GetReference(utf8Data))
src\libraries\System.Private.CoreLib\src\System\Text\UnicodeEncoding.cs (3)
158fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 201fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 293fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars))
src\libraries\System.Private.CoreLib\src\System\Text\UTF32Encoding.cs (3)
166fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 209fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 301fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars))
src\libraries\System.Private.CoreLib\src\System\Text\UTF7Encoding.cs (3)
202fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 245fixed (byte* pBytes = &MemoryMarshal.GetArrayDataReference(bytes)) 337fixed (char* pChars = &MemoryMarshal.GetArrayDataReference(chars))
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (10)
194fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 365fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 366fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 375fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 376fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 487fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 560fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 561fixed (char* charsPtr = &MemoryMarshal.GetReference(chars)) 570fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes)) 571fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (4)
750ref byte address = ref MemoryMarshal.GetReference(destination); 866ref byte sourceRef = ref MemoryMarshal.GetReference(source); 923ref byte sourceRef = ref MemoryMarshal.GetReference(source); 979ref byte address = ref MemoryMarshal.GetReference(destination);
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (4)
318ref byte sourceRef = ref MemoryMarshal.GetReference(source); 368ref byte sourceRef = ref MemoryMarshal.GetReference(source); 403Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 421Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (4)
339ref byte sourceRef = ref MemoryMarshal.GetReference(source); 396ref byte sourceRef = ref MemoryMarshal.GetReference(source); 441Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 459Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (4)
338ref byte sourceRef = ref MemoryMarshal.GetReference(source); 395ref byte sourceRef = ref MemoryMarshal.GetReference(source); 440Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 458Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (4)
342ref byte sourceRef = ref MemoryMarshal.GetReference(source); 399ref byte sourceRef = ref MemoryMarshal.GetReference(source); 449Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 472Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\System\Array.CoreCLR.cs (14)
74ref byte src = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(sourceArray), (uint)sourceIndex * elementSize); 75ref byte dst = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(destinationArray), (uint)destinationIndex * elementSize); 242ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex); 243ref byte data = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(destinationArray), (nuint)destinationIndex * destSize); 285ref byte data = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcSize); 286ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex); 300ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex); 301ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex); 325ref byte srcData = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcElSize); 326ref byte data = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(destinationArray), (nuint)destinationIndex * destElSize); 358ref byte pStart = ref MemoryMarshal.GetArrayDataReference(array); 470ref byte arrayDataRef = ref MemoryMarshal.GetArrayDataReference(this); 511ref byte arrayDataRef = ref MemoryMarshal.GetArrayDataReference(this); 683ref byte arrayRef = ref MemoryMarshal.GetArrayDataReference(this);
src\System\Buffer.CoreCLR.cs (1)
34Memmove(ref *(pDest + (uint)destIndex), ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(src), (nint)(uint)srcIndex /* force zero-extension */), (uint)len);
src\System\Reflection\AssemblyName.CoreCLR.cs (1)
149AssemblyNameParser.AssemblyNameParts parts = AssemblyNameParser.Parse(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(pAssemblyName));
src\System\Reflection\MdImport.cs (5)
264: Text.Encoding.UTF8.GetString(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(safeArrayUserDefinedSubTypeRaw)); 267: Text.Encoding.UTF8.GetString(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(marshalTypeRaw)); 270: Text.Encoding.UTF8.GetString(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(marshalCookieRaw)); 601importName = Text.Encoding.UTF8.GetString(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(importNameRaw)); 602importDll = Text.Encoding.UTF8.GetString(MemoryMarshal.CreateReadOnlySpanFromNullTerminated(importDllRaw));
src\System\Reflection\TypeNameResolver.CoreCLR.cs (1)
133ReadOnlySpan<char> typeName = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(pTypeName);
src\System\Runtime\CompilerServices\CastHelpers.cs (2)
397ref object? element = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index); 414ref object? element = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index);
src\System\Runtime\CompilerServices\RuntimeHelpers.CoreCLR.cs (1)
51ref byte dst = ref MemoryMarshal.GetArrayDataReference(array);
src\System\Runtime\CompilerServices\StaticsHelpers.cs (1)
183object? threadStaticObjectNonCollectible = Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(t_ThreadStatics->NonCollectibleTlsArrayData), indexOffset - ThreadLocalData.NUMBER_OF_TLSOFFSETS_NOT_USED_IN_NONCOLLECTIBLE_ARRAY);
src\System\StubHelpers.cs (3)
111SpanHelpers.Memmove(ref *pbNativeBuffer, ref MemoryMarshal.GetArrayDataReference(bytes), (nuint)nb); 368SpanHelpers.Memmove(ref *pNative, ref MemoryMarshal.GetArrayDataReference(bytes), (nuint)nbytesused); 417SpanHelpers.Memmove(ref *(byte*)bstr, ref MemoryMarshal.GetArrayDataReference(bytes), length);
src\System\ValueType.cs (2)
118hashCode.AddBytes(MemoryMarshal.CreateReadOnlySpan(ref rawData, (int)size)); 139hashCode.AddBytes(MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AddByteOffset(ref rawData, fieldOffset), (int)fieldSize));
System.Private.DataContractSerialization (16)
System\Xml\XmlBinaryWriter.cs (11)
110ref byte bytePtr = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(buffer), offset); 125ref byte bytePtr = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(buffer), offset); 609fixed (char* pch = &MemoryMarshal.GetReference(chars)) 862WriteArray(XmlBinaryNodeType.BoolTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 869WriteArray(XmlBinaryNodeType.Int16TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 885WriteArray(XmlBinaryNodeType.Int32TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 901WriteArray(XmlBinaryNodeType.Int64TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 917WriteArray(XmlBinaryNodeType.FloatTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 935WriteArray(XmlBinaryNodeType.DoubleTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 953WriteArray(XmlBinaryNodeType.DecimalTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items)); 987WriteArray(XmlBinaryNodeType.GuidTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
System\Xml\XmlBufferReader.cs (3)
488ReadRawArrayBytes(MemoryMarshal.AsBytes(dst)); 942T value = MemoryMarshal.Read<T>(buffer); 949=> MemoryMarshal.Read<T>(_buffer.AsSpan(offset, sizeof(T)));
System\Xml\XmlStreamNodeWriter.cs (2)
341.CopyTo(MemoryMarshal.Cast<byte, char>(buffer.AsSpan(offset))); 346MemoryMarshal.Cast<byte, short>(buffer.AsSpan(offset)));
System.Private.Uri (5)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\UriExt.cs (2)
647!Unsafe.AreSame(ref MemoryMarshal.GetReference(charsToUnescape), ref MemoryMarshal.GetReference(destination));
System\UriHelper.cs (1)
358fixed (char* pStr = &MemoryMarshal.GetReference(input))
System.Private.Windows.Core (21)
System\BufferScope.cs (1)
110public readonly ref T GetPinnableReference() => ref MemoryMarshal.GetReference(_span);
System\IO\BinaryReaderExtensions.cs (5)
133Span<ushort> ushorts = MemoryMarshal.Cast<byte, ushort>(arrayData); 138Span<int> ints = MemoryMarshal.Cast<byte, int>(arrayData); 143Span<long> longs = MemoryMarshal.Cast<byte, long>(arrayData); 254writer.Write(MemoryMarshal.Cast<T, char>(span)); 260writer.Write(MemoryMarshal.Cast<T, byte>(span));
System\SpanReader.cs (8)
148value = Unsafe.ReadUnaligned<TValue>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(_unread))); 161/// This effectively does a <see cref="MemoryMarshal.Cast{TFrom, TTo}(ReadOnlySpan{TFrom})"/> and the same 182value = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, TValue>(ref MemoryMarshal.GetReference(_unread)), count); 270span = MemoryMarshal.CreateReadOnlySpan(ref MemoryMarshal.GetReference(span), length); 280span = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)start), length);
System\SpanWriter.cs (2)
103span = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)start), length);
Windows\Win32\Graphics\Gdi\ARGB.cs (2)
59MemoryMarshal.CreateReadOnlySpan( 60ref Unsafe.As<uint, ARGB>(ref MemoryMarshal.GetReference(argbColors)),
Windows\Win32\System\Com\IComCallableWrapper.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Windows\Win32\System\Com\IID.cs (1)
21return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Windows\Win32\System\Variant\VARIANT.cs (1)
869=> MemoryMarshal.CreateSpan(ref Unsafe.AsRef<T>(Marshal.UnsafeAddrOfPinnedArrayElement(array, 0).ToPointer()), array.Length);
System.Private.Xml (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Xml\BinaryXml\XmlBinaryReader.cs (1)
2335Span<byte> dstBytes = MemoryMarshal.AsBytes(dstChars);
System\Xml\XmlCharType.cs (1)
186private static uint GetCharProperties(char ch) => Unsafe.Add(ref MemoryMarshal.GetReference(CharProperties), ch);
System.Reflection.Metadata (5)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Reflection\Metadata\BlobBuilder.cs (1)
1003WriteBytesUnchecked(MemoryMarshal.AsBytes(value));
System\Reflection\Metadata\BlobWriter.cs (1)
400WriteBytes(MemoryMarshal.AsBytes(value));
System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs (1)
281return GetOrAddBlob(MemoryMarshal.AsBytes(value.AsSpan()));
System.Resources.Extensions (1)
src\libraries\System.Private.CoreLib\src\System\IO\PinnedBufferMemoryStream.cs (1)
26fixed (byte* ptr = &MemoryMarshal.GetReference((Span<byte>)array))
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
658[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))]
System.Runtime.Numerics (59)
src\libraries\Common\src\System\Number.Formatting.Common.cs (5)
328fixed (char* pFormat = &MemoryMarshal.GetReference(format)) 527fixed (char* pFormat = &MemoryMarshal.GetReference(format)) 793fixed (TChar* spanPtr = &MemoryMarshal.GetReference(vlb.AppendSpan(bufferSize))) 880r.EncodeToUtf8(MemoryMarshal.AsBytes(vlb.AppendSpan(r.Utf8SequenceLength))); 1135fixed (char* pFormat = &MemoryMarshal.GetReference(format))
src\libraries\Common\src\System\Number.NumberBuffer.cs (1)
33public readonly byte* DigitsPtr => (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(Digits)); // safe since constructor expects Digits to refer to unmovable memory
src\libraries\Common\src\System\Number.Parsing.Common.cs (2)
285fixed (TChar* stringPointer = &MemoryMarshal.GetReference(value)) 341fixed (TChar* stringPointer = &MemoryMarshal.GetReference(value))
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (3)
28uint index = Unsafe.Add(ref MemoryMarshal.GetReference(log2ToPow10), BitOperations.Log2(value)); 56ulong powerOf10 = Unsafe.Add(ref MemoryMarshal.GetReference(powersOf10), index); 106long tableValue = Unsafe.Add(ref MemoryMarshal.GetReference(table), uint.Log2(value));
System\Number.BigInteger.cs (11)
105if (!TryStringToNumber(MemoryMarshal.Cast<char, Utf16Char>(value), style, ref number, info)) 843fixed (char* ptr = &MemoryMarshal.GetReference(destination)) 861fixed (char* ptr = &MemoryMarshal.GetReference(span)) 897spanSuccess = vlb.TryCopyTo(MemoryMarshal.Cast<char, Utf16Char>(destination), out charsWritten); 904strResult = MemoryMarshal.Cast<Utf16Char, char>(vlb.AsSpan()).ToString(); 1225return uint.TryParse(MemoryMarshal.Cast<TChar, char>(input), TParser.BlockNumberStyle, null, out result); 1238ref TChar lastWholeBlockStart = ref Unsafe.Add(ref MemoryMarshal.GetReference(input), input.Length - TParser.DigitsPerBlock); 1243MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Subtract(ref lastWholeBlockStart, i * TParser.DigitsPerBlock), TParser.DigitsPerBlock), 1269if (Convert.FromHexString(MemoryMarshal.Cast<TChar, char>(input), MemoryMarshal.AsBytes(destination), out _, out _) != OperationStatus.Done) 1276MemoryMarshal.AsBytes(destination).Reverse();
System\Number.Polyfill.cs (11)
85return MemoryMarshal.Cast<char, TChar>(info.PositiveSign); 93return MemoryMarshal.Cast<char, TChar>(info.NegativeSign); 101return MemoryMarshal.Cast<char, TChar>(info.CurrencySymbol); 109return MemoryMarshal.Cast<char, TChar>(info.PercentSymbol); 117return MemoryMarshal.Cast<char, TChar>(info.PerMilleSymbol); 125return MemoryMarshal.Cast<char, TChar>(info.CurrencyDecimalSeparator); 133return MemoryMarshal.Cast<char, TChar>(info.CurrencyGroupSeparator); 141return MemoryMarshal.Cast<char, TChar>(info.NumberDecimalSeparator); 149return MemoryMarshal.Cast<char, TChar>(info.NumberGroupSeparator); 157return MemoryMarshal.Cast<char, TChar>(info.PercentDecimalSeparator); 165return MemoryMarshal.Cast<char, TChar>(info.PercentGroupSeparator);
System\Numerics\BigInteger.cs (9)
375Span<byte> uintBytes = MemoryMarshal.AsBytes(val.AsSpan(0, wholeUInt32Count)); 387value.Slice(0, wholeUInt32Count * 4).CopyTo(MemoryMarshal.AsBytes<uint>(val)); 1085hash.AddBytes(MemoryMarshal.AsBytes(_bits.AsSpan())); 3607Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 3613ref byte startAddress = ref MemoryMarshal.GetReference(destination); 3634ref byte startAddress = ref MemoryMarshal.GetReference(destination); 3709Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 3715ref byte address = ref MemoryMarshal.GetReference(destination); 3735ref byte address = ref MemoryMarshal.GetReference(destination);
System\Numerics\BigIntegerCalculator.AddSub.cs (10)
24Add(left, bits, ref MemoryMarshal.GetReference(bits), startIndex: 0, initialCarry: right); 35ref uint resultPtr = ref MemoryMarshal.GetReference(bits); 36ref uint rightPtr = ref MemoryMarshal.GetReference(right); 37ref uint leftPtr = ref MemoryMarshal.GetReference(left); 68ref uint leftPtr = ref MemoryMarshal.GetReference(left); 96Subtract(left, bits, ref MemoryMarshal.GetReference(bits), startIndex: 0, initialCarry: -right); 108ref uint resultPtr = ref MemoryMarshal.GetReference(bits); 109ref uint rightPtr = ref MemoryMarshal.GetReference(right); 110ref uint leftPtr = ref MemoryMarshal.GetReference(left); 143ref uint leftPtr = ref MemoryMarshal.GetReference(left);
System\Numerics\BigIntegerCalculator.SquMul.cs (4)
38ref uint resultPtr = ref MemoryMarshal.GetReference(bits); 337ref uint resultPtr = ref MemoryMarshal.GetReference(bits); 379ref uint leftPtr = ref MemoryMarshal.GetReference(left); 380ref uint corePtr = ref MemoryMarshal.GetReference(core);
System\Numerics\NumericsHelpers.cs (1)
127ref uint start = ref MemoryMarshal.GetReference(d);
System.Security.Cryptography (68)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (1)
40if (!Unsafe.IsNullRef(ref MemoryMarshal.GetReference(password)))
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
40ref byte pathReference = ref MemoryMarshal.GetReference(converter.ConvertAndTerminateString(path)); 46int resultLength = ReadLink(ref pathReference, ref MemoryMarshal.GetReference(spanBuffer), spanBuffer.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (1)
44BioWrite(b, ref MemoryMarshal.GetReference(data), data.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Dsa.cs (4)
66DsaSign(dsa, ref MemoryMarshal.GetReference(hash), hash.Length, ref MemoryMarshal.GetReference(refSignature), out outSignatureLength); 76ref MemoryMarshal.GetReference(hash), 78ref MemoryMarshal.GetReference(signature),
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs (12)
41ref MemoryMarshal.GetReference(key), 42ref MemoryMarshal.GetReference(iv), 84fixed (byte* pIv = &MemoryMarshal.GetReference(iv)) 111ref MemoryMarshal.GetReference(output), 113ref MemoryMarshal.GetReference(input), 142return EvpCipherFinalEx(ctx, ref MemoryMarshal.GetReference(output), out bytesWritten); 154if (!EvpCipherGetGcmTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length)) 169if (!EvpCipherGetAeadTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length)) 184if (!EvpCipherSetGcmTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length)) 199if (!EvpCipherSetAeadTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length)) 214if (!EvpCipherGetCcmTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length)) 229if (!EvpCipherSetCcmTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length))
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.Ecdh.cs (1)
33ref MemoryMarshal.GetReference(destination),
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.EcDsa.cs (4)
31ref MemoryMarshal.GetReference(hash), 33ref MemoryMarshal.GetReference(destination), 62ref MemoryMarshal.GetReference(hash), 64ref MemoryMarshal.GetReference(signature),
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.Rsa.cs (8)
69ref MemoryMarshal.GetReference(source), 73ref MemoryMarshal.GetReference(destination), 106ref MemoryMarshal.GetReference(source), 110ref MemoryMarshal.GetReference(destination), 149ref MemoryMarshal.GetReference(hash), 151ref MemoryMarshal.GetReference(destination), 190ref MemoryMarshal.GetReference(hash), 192ref MemoryMarshal.GetReference(signature),
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (1)
87ref MemoryMarshal.GetReference(buf),
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Pkcs7.cs (1)
16DecodePkcs7(ref MemoryMarshal.GetReference(buf), buf.Length);
src\libraries\Common\src\System\Security\Cryptography\EccKeyFormatHelper.cs (1)
89fixed (byte* ptr = &MemoryMarshal.GetReference(key))
src\libraries\Common\src\System\Security\Cryptography\Helpers.cs (1)
67return Unsafe.IsNullRef(ref MemoryMarshal.GetReference(span));
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.cs (2)
23fixed (byte* ptr = &MemoryMarshal.GetReference(source)) 99fixed (byte* ptr = &MemoryMarshal.GetReference(source))
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (2)
23fixed (byte* ptr = &MemoryMarshal.GetReference(source)) 40fixed (byte* ptr = &MemoryMarshal.GetReference(source))
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (2)
196fixed (byte* maybeRentedPtr = &MemoryMarshal.GetReference(buf)) 481fixed (byte* maybeRentedPtr = &MemoryMarshal.GetReference(buf))
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
127if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(password)))
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Security\Cryptography\CryptoStream.cs (2)
378if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> bufferArray)) 651if (MemoryMarshal.TryGetArray(inputBuffer, out ArraySegment<byte> segment))
System\Security\Cryptography\Helpers.cs (2)
332return ref buffer.Length != 0 ? ref MemoryMarshal.GetReference(buffer) : ref Unsafe.AsRef<byte>((void*)1); 339return ref buffer.Length != 0 ? ref MemoryMarshal.GetReference(buffer) : ref Unsafe.AsRef<byte>((void*)1);
System\Security\Cryptography\LiteHash.Unix.cs (5)
162Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); 176Check(Interop.Crypto.EvpDigestCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); 223_ctx = Interop.Crypto.HmacCreate(ref MemoryMarshal.GetReference(key), key.Length, algorithm); 248Check(Interop.Crypto.HmacCurrent(_ctx, ref MemoryMarshal.GetReference(destination), ref length)); 258Check(Interop.Crypto.HmacFinal(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
System\Security\Cryptography\OpenSslCipherLite.cs (2)
38ref MemoryMarshal.GetReference(key), 40ref MemoryMarshal.GetReference(iv),
System\Security\Cryptography\RandomNumberGenerator.cs (1)
129Span<byte> oneUintBytes = MemoryMarshal.AsBytes(new Span<uint>(ref oneUint));
System\Security\Cryptography\RSA.cs (4)
877fixed (byte* ptr = &MemoryMarshal.GetReference(source)) 902fixed (byte* ptr = &MemoryMarshal.GetReference(source)) 932fixed (byte* ptr = &MemoryMarshal.GetReference(source)) 971fixed (byte* ptr = &MemoryMarshal.GetReference(source))
System\Security\Cryptography\X509Certificates\OpenSslCrlCache.cs (2)
282ReadOnlySpan<byte> utf16Url = MemoryMarshal.AsBytes(crlUrl.AsSpan()); 290uint urlHash = MemoryMarshal.Read<uint>(hash);
System\Security\Cryptography\X509Certificates\OpenSslX509CertificateReader.cs (1)
158ref MemoryMarshal.GetReference(rawData),
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (1)
291tempChain = MemoryMarshal.Cast<byte, IntPtr>(tempChainRent.AsSpan(0, targetSize));
System\Security\Cryptography\X509Certificates\PublicKey.cs (1)
298fixed (byte* ptr = &MemoryMarshal.GetReference(source))
System\Security\Cryptography\X509Certificates\UnixExportProvider.cs (1)
198MemoryMarshal.Write(attrBytes.AsSpan(2), in keyIdx);
System.Security.Cryptography.Cose (2)
System\Security\Cryptography\Cose\CoseMessage.cs (2)
111fixed (byte* ptr = &MemoryMarshal.GetReference(cborPayload)) 197fixed (byte* ptr = &MemoryMarshal.GetReference(cborPayload))
System.Security.Cryptography.Pkcs (8)
src\libraries\Common\src\System\Security\Cryptography\Helpers.cs (1)
67return Unsafe.IsNullRef(ref MemoryMarshal.GetReference(span));
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.cs (2)
23fixed (byte* ptr = &MemoryMarshal.GetReference(source)) 99fixed (byte* ptr = &MemoryMarshal.GetReference(source))
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (2)
23fixed (byte* ptr = &MemoryMarshal.GetReference(source)) 40fixed (byte* ptr = &MemoryMarshal.GetReference(source))
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (2)
196fixed (byte* maybeRentedPtr = &MemoryMarshal.GetReference(buf)) 481fixed (byte* maybeRentedPtr = &MemoryMarshal.GetReference(buf))
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
127if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(password)))
System.ServiceModel.NetFramingBase (1)
System\ServiceModel\Channels\SingletonConnectionReader.cs (1)
533if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array))
System.ServiceModel.NetTcp (1)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
50SetBuffer(MemoryMarshal.AsMemory(memory));
System.ServiceModel.UnixDomainSocket (1)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
50SetBuffer(MemoryMarshal.AsMemory(memory));
System.Text.Encoding.CodePages (1)
System\Text\CodePagesEncodingProvider.cs (1)
201MemoryMarshal.GetArrayDataReference(array);
System.Text.Encodings.Web (11)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Text\Encodings\Web\SpanUtility.cs (7)
48Unsafe.WriteUnaligned<uint>(ref MemoryMarshal.GetReference(span), abcd32); 78ref byte rDest = ref MemoryMarshal.GetReference(span); 113ref byte rDest = ref MemoryMarshal.GetReference(span); 145Unsafe.WriteUnaligned<ulong>(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(span)), abcd64); 175ref char rDest = ref MemoryMarshal.GetReference(span); 210ref byte rDest = ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(span)); 234Unsafe.WriteUnaligned<ulong>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)offset), value);
System\Text\Encodings\Web\TextEncoder.cs (2)
44fixed (char* pBuffer = &MemoryMarshal.GetReference(buffer)) 543fixed (char* pText = &MemoryMarshal.GetReference(text))
System.Text.Json (17)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Text\Json\Document\JsonDocument.MetadataDb.cs (10)
229MemoryMarshal.Write(_data.AsSpan(Length), ref row); 279MemoryMarshal.Write(destination, ref length); 288int current = MemoryMarshal.Read<int>(dataPos); 292MemoryMarshal.Write(dataPos, ref value); 301int current = MemoryMarshal.Read<int>(dataPos); 304MemoryMarshal.Write(dataPos, ref value); 319DbRow row = MemoryMarshal.Read<DbRow>(data.Slice(i)); 335return MemoryMarshal.Read<DbRow>(_data.AsSpan(index)); 341uint union = MemoryMarshal.Read<uint>(_data.AsSpan(index + NumberOfRowsOffset)); 384Span<int> newDbInts = MemoryMarshal.Cast<byte, int>(newDatabase);
System\Text\Json\Document\JsonDocument.StackRowStack.cs (2)
50MemoryMarshal.Write(_rentedBuffer.AsSpan(_topOfStack), ref row); 58StackRow row = MemoryMarshal.Read<StackRow>(_rentedBuffer.AsSpan(_topOfStack));
System\Text\Json\Document\JsonElement.cs (2)
1479return Unsafe.IsNullRef(ref MemoryMarshal.GetReference(utf8Text)); 1507return Unsafe.IsNullRef(ref MemoryMarshal.GetReference(text));
System\Text\Json\Serialization\Metadata\PropertyRef.cs (1)
55ref byte reference = ref MemoryMarshal.GetReference(name);
System.Text.RegularExpressions (4)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System\Text\RegularExpressions\RegexCompiler.cs (1)
103private static readonly MethodInfo s_memoryMarshalGetArrayDataReferenceSearchValues = typeof(MemoryMarshal).GetMethod("GetArrayDataReference", [Type.MakeGenericMethodParameter(0).MakeArrayType()])!.MakeGenericMethod(typeof(SearchValues<char>))!;
System\Text\RegularExpressions\Symbolic\BitVector.cs (1)
178hc.AddBytes(MemoryMarshal.AsBytes<ulong>(_blocks));
System.Text.RegularExpressions.Generator (3)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
Stubs.cs (1)
19fixed (char* ptr = &MemoryMarshal.GetReference(span))
System.Web.HttpUtility (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
64return ref MemoryMarshal.GetReference(_chars); 78return ref MemoryMarshal.GetReference(_chars);
System.Windows.Forms (2)
System\Windows\Forms\Dialogs\CommonDialogs\ColorDialog.cs (2)
78MemoryMarshal.Cast<COLORREF, int>(_customColors).CopyTo(result); 88MemoryMarshal.Cast<int, COLORREF>(value)[..Math.Min(customColors.Length, value.Length)].CopyTo(customColors);
System.Windows.Forms.Primitives (7)
Microsoft\Office\IMsoComponent.cs (1)
118return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\Office\IMsoComponentManager.cs (1)
30return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\ICategorizeProperties.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\IProvidePropertyBuilder.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\IVSMDPerPropertyBrowsing.cs (1)
29return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\IVsPerPropertyBrowsing.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
System\Windows\Forms\IExtender.cs (1)
99return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
System.Windows.Forms.Primitives.Tests (1)
Windows\Win32\System\Com\ComScopeTests.cs (1)
63return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));