5200 references to Unsafe
http2cat (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.FunctionalTests (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.LongTests (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.NewHandler.FunctionalTests (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.NewShim.FunctionalTests (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IIS.ShadowCopy.Tests (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
IISExpress.FunctionalTests (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
InMemory.FunctionalTests (28)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
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.Server (2)
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.Components.WebAssembly (1)
Rendering\WebAssemblyRenderer.cs (1)
146RenderBatch(RendererId, Unsafe.AsPointer(ref batchCopy));
Microsoft.AspNetCore.Grpc.JsonTranscoding (6)
Internal\Json\EnumConverter.cs (6)
90if (Unsafe.SizeOf<int>() == Unsafe.SizeOf<TEnum>()) 92integer = Unsafe.As<TEnum, int>(ref value); 102if (Unsafe.SizeOf<int>() == Unsafe.SizeOf<TEnum>()) 104value = Unsafe.As<int, TEnum>(ref integer);
Microsoft.AspNetCore.OutputCaching (10)
FormatterBinaryReader.cs (3)
40return Unsafe.Add(ref _root, _offset++); 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 (7)
28root = ref Unsafe.NullRef<byte>(); // no buffer initially 39return MemoryMarshal.CreateSpan(ref Unsafe.Add(ref root, offset), length - offset); 47if (Unsafe.IsNullRef(ref root)) 68Unsafe.Add(ref root, offset++) = value; 125if (!Unsafe.IsNullRef(ref root)) 129root = ref Unsafe.NullRef<byte>(); 137Unsafe.Add(ref root, offset++) = value;
Microsoft.AspNetCore.Routing (14)
Matching\ILEmitTrieFactory.cs (14)
546ref var p = ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(span)); 547return Unsafe.ReadUnaligned<ulong>(ref p); 661Add = typeof(Unsafe).GetMethod( 662nameof(Unsafe.Add), 675As = typeof(Unsafe).GetMethod( 676nameof(Unsafe.As), 714ReadUnalignedUInt64 = typeof(Unsafe).GetMethod( 715nameof(Unsafe.ReadUnaligned), 726ReadUnalignedUInt16 = typeof(Unsafe).GetMethod( 727nameof(Unsafe.ReadUnaligned), 740/// <see cref="Unsafe.Add{T}(ref T, int)"/> - Add[ref byte] 745/// <see cref="Unsafe.As{TFrom, TTo}(ref TFrom)"/> - As[char, byte] 760/// <see cref="Unsafe.ReadUnaligned{T}(ref readonly byte)"/> - ReadUnaligned[ulong] 765/// <see cref="Unsafe.ReadUnaligned{T}(ref readonly byte)"/> - ReadUnaligned[ushort]
Microsoft.AspNetCore.Server.HttpSys (14)
RequestProcessing\Response.cs (1)
615Unsafe.SkipInit(out dataChunk);
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 (1)
110ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.IIS (13)
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 (1)
110ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.Kestrel.Core (164)
Internal\Http\HttpHeaders.Generated.cs (84)
7486ushort result = Unsafe.ReadUnaligned<ushort>(ref source); 7496uint result = Unsafe.ReadUnaligned<uint>(ref source); 7506ulong result = Unsafe.ReadUnaligned<ulong>(ref source); 7518ref StringValues values = ref Unsafe.AsRef<StringValues>(null); 7533if (((ReadUnalignedLittleEndian_ushort(ref nameStart) & 0xdfdfu) == 0x4956u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)2) & 0xdfu) == 0x41u)) 7562if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfffu) == 0x5441503au) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)4) & 0xdfu) == 0x48u)) 7568else if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfdfu) == 0x474e4152u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)4) & 0xdfu) == 0x45u)) 7577if ((firstTerm6 == 0x45434341u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x5450u)) 7583else if ((firstTerm6 == 0x4b4f4f43u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4549u)) 7589else if ((firstTerm6 == 0x45505845u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x5443u)) 7595else if ((firstTerm6 == 0x4749524fu) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4e49u)) 7601else if ((firstTerm6 == 0x47415250u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x414du)) 7609if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfffu) == 0x54454d3au) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4f48u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)6) & 0xdfu) == 0x44u)) 7615else if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfffu) == 0x4843533au) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4d45u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)6) & 0xdfu) == 0x45u)) 7621else if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfdfu) == 0x47474142u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4741u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)6) & 0xdfu) == 0x45u)) 7627else if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfdfu) == 0x45464552u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4552u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)6) & 0xdfu) == 0x52u)) 7633else if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfdfu) == 0x52475055u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4441u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)6) & 0xdfu) == 0x45u)) 7639else if (((ReadUnalignedLittleEndian_uint(ref nameStart) & 0xdfdfdfdfu) == 0x4e524157u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ushort)))) & 0xdfdfu) == 0x4e49u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)6) & 0xdfu) == 0x47u)) 7667if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfffuL) == 0x4f434f544f52503auL) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)8) & 0xdfu) == 0x4cu)) 7673else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfdfuL) == 0x54414c534e415254uL) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)8) & 0xdfu) == 0x45u)) 7681if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfdfuL) == 0x495443454e4e4f43uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(ushort)))) & 0xdfdfu) == 0x4e4fu)) 7687else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfffdfdfdfdfuL) == 0x4547412d52455355uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(ushort)))) & 0xdfdfu) == 0x544eu)) 7693else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfffuL) == 0x49524f485455413auL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(ushort)))) & 0xdfdfu) == 0x5954u)) 7699else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfffdfdfdfdfuL) == 0x494c412d5045454buL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(ushort)))) & 0xdfdfu) == 0x4556u)) 7705else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xffdfdfdfdfdfdfdfuL) == 0x2d54534555514552uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(ushort)))) & 0xdfdfu) == 0x4449u)) 7711else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfdfuL) == 0x4154534543415254uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(ushort)))) & 0xdfdfu) == 0x4554u)) 7719if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfdfuL) == 0x5241504543415254uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(ushort)))) & 0xdfdfu) == 0x4e45u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)10) & 0xdfu) == 0x54u)) 7727if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xffdfdfdfdfdfdfdfuL) == 0x2d544e45544e4f43uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x45505954u)) 7733else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfffdfdfdfdfuL) == 0x4d49542d43505247uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x54554f45u)) 7739else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfffdfdfdfuL) == 0x57524f462d58414duL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x53445241u)) 7747if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfdfuL) == 0x5a49524f48545541uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x4f495441u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)12) & 0xdfu) == 0x4eu)) 7753else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfffdfdfdfdfdfuL) == 0x4f432d4548434143uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x4f52544eu) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)12) & 0xdfu) == 0x4cu)) 7759else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfffdfdfdfdfuL) == 0x434e452d43505247uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x4e49444fu) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)12) & 0xdfu) == 0x47u)) 7765else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xffdfdfdfdfffdfdfuL) == 0x2d454e4f4e2d4649uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x4354414du) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)12) & 0xdfu) == 0x48u)) 7773if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfffdfdfdfdfdfdfuL) == 0x432d545045434341uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x53524148u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(6 * sizeof(ushort)))) & 0xdfdfu) == 0x5445u)) 7779else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xffdfdfdfdfdfdfdfuL) == 0x2d544e45544e4f43uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x474e454cu) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(6 * sizeof(ushort)))) & 0xdfdfu) == 0x4854u)) 7796if ((firstTerm15 == 0x452d545045434341uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x444f434eu) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(6 * sizeof(ushort)))) & 0xdfdfu) == 0x4e49u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)14) & 0xdfu) == 0x47u)) 7802else if ((firstTerm15 == 0x4c2d545045434341uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x55474e41u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(6 * sizeof(ushort)))) & 0xdfdfu) == 0x4741u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)14) & 0xdfu) == 0x45u)) 7810if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfffdfdfuL) == 0x4649444f4d2d4649uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfdfdfdfffdfdfdfuL) == 0x434e49532d444549uL) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)16) & 0xdfu) == 0x45u)) 7816else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfdfuL) == 0x524546534e415254uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfdfdfdfdfdfdfffuL) == 0x4e49444f434e452duL) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)16) & 0xdfu) == 0x47u)) 7824if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfdfdfdfuL) == 0x54414c4552524f43uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfdfdfdfffdfdfdfuL) == 0x544e4f432d4e4f49uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(8 * sizeof(ushort)))) & 0xdfdfu) == 0x5845u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)18) & 0xdfu) == 0x54u)) 7830else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfdfdfffdfdfuL) == 0x444f4d4e552d4649uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfdfffdfdfdfdfdfuL) == 0x49532d4445494649uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(8 * sizeof(ushort)))) & 0xdfdfu) == 0x434eu) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)18) & 0xdfu) == 0x45u)) 7836else if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfffdfdfdfdfdfuL) == 0x55412d59584f5250uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfdfdfdfdfdfdfdfuL) == 0x54415a49524f4854uL) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(8 * sizeof(ushort)))) & 0xdfdfu) == 0x4f49u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)18) & 0xdfu) == 0x4eu)) 7844if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfdfdfffdfdfdfdfuL) == 0x4343412d43505247uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfdfdfdfffdfdfdfuL) == 0x4f434e452d545045uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(4 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x474e4944u)) 7852if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xffdfdfdfdfdfdfdfuL) == 0x2d45444152475055uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfdfdfdfdfdfdfdfuL) == 0x4552554345534e49uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ulong)))) & 0xdfdfdfdfdfdfdfffuL) == 0x545345555145522duL) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)24) & 0xdfu) == 0x53u)) 7860if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfffdfdfdfdfdfdfuL) == 0x432d535345434341uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfffdfdfdfdfdfdfuL) == 0x522d4c4f52544e4fuL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ulong)))) & 0xdfffdfdfdfdfdfdfuL) == 0x4d2d545345555145uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(6 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x4f485445u) && ((Unsafe.AddByteOffset(ref nameStart, (IntPtr)28) & 0xdfu) == 0x44u)) 7868if (((ReadUnalignedLittleEndian_ulong(ref nameStart) & 0xdfffdfdfdfdfdfdfuL) == 0x432d535345434341uL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)sizeof(ulong))) & 0xdfffdfdfdfdfdfdfuL) == 0x522d4c4f52544e4fuL) && ((ReadUnalignedLittleEndian_ulong(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(2 * sizeof(ulong)))) & 0xdfffdfdfdfdfdfdfuL) == 0x482d545345555145uL) && ((ReadUnalignedLittleEndian_uint(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(6 * sizeof(uint)))) & 0xdfdfdfdfu) == 0x45444145u) && ((ReadUnalignedLittleEndian_ushort(ref Unsafe.AddByteOffset(ref nameStart, (IntPtr)(14 * sizeof(ushort)))) & 0xdfdfu) == 0x5352u)) 7929ref StringValues values = ref Unsafe.AsRef<StringValues>(null); 8141ref StringValues values = ref Unsafe.AsRef<StringValues>(null); 14826ref readonly StringValues values = ref Unsafe.AsRef<StringValues>(null);
Internal\Http\HttpProtocol.Generated.cs (70)
500feature = Unsafe.As<IHttpRequestFeature?, TFeature?>(ref _currentIHttpRequestFeature); 504feature = Unsafe.As<IHttpResponseFeature?, TFeature?>(ref _currentIHttpResponseFeature); 508feature = Unsafe.As<IHttpResponseBodyFeature?, TFeature?>(ref _currentIHttpResponseBodyFeature); 512feature = Unsafe.As<IRouteValuesFeature?, TFeature?>(ref _currentIRouteValuesFeature); 516feature = Unsafe.As<IEndpointFeature?, TFeature?>(ref _currentIEndpointFeature); 520feature = Unsafe.As<IServiceProvidersFeature?, TFeature?>(ref _currentIServiceProvidersFeature); 524feature = Unsafe.As<IHttpActivityFeature?, TFeature?>(ref _currentIHttpActivityFeature); 528feature = Unsafe.As<IHttpMetricsTagsFeature?, TFeature?>(ref _currentIHttpMetricsTagsFeature); 532feature = Unsafe.As<IItemsFeature?, TFeature?>(ref _currentIItemsFeature); 536feature = Unsafe.As<IQueryFeature?, TFeature?>(ref _currentIQueryFeature); 540feature = Unsafe.As<IRequestBodyPipeFeature?, TFeature?>(ref _currentIRequestBodyPipeFeature); 544feature = Unsafe.As<IFormFeature?, TFeature?>(ref _currentIFormFeature); 548feature = Unsafe.As<IHttpAuthenticationFeature?, TFeature?>(ref _currentIHttpAuthenticationFeature); 552feature = Unsafe.As<IHttpRequestIdentifierFeature?, TFeature?>(ref _currentIHttpRequestIdentifierFeature); 556feature = Unsafe.As<IHttpConnectionFeature?, TFeature?>(ref _currentIHttpConnectionFeature); 560feature = Unsafe.As<ISessionFeature?, TFeature?>(ref _currentISessionFeature); 564feature = Unsafe.As<IResponseCookiesFeature?, TFeature?>(ref _currentIResponseCookiesFeature); 568feature = Unsafe.As<IHttpRequestTrailersFeature?, TFeature?>(ref _currentIHttpRequestTrailersFeature); 572feature = Unsafe.As<IHttpResponseTrailersFeature?, TFeature?>(ref _currentIHttpResponseTrailersFeature); 576feature = Unsafe.As<ITlsConnectionFeature?, TFeature?>(ref _currentITlsConnectionFeature); 580feature = Unsafe.As<IHttpExtendedConnectFeature?, TFeature?>(ref _currentIHttpExtendedConnectFeature); 584feature = Unsafe.As<IHttpUpgradeFeature?, TFeature?>(ref _currentIHttpUpgradeFeature); 588feature = Unsafe.As<IHttpWebSocketFeature?, TFeature?>(ref _currentIHttpWebSocketFeature); 592feature = Unsafe.As<IHttpWebTransportFeature?, TFeature?>(ref _currentIHttpWebTransportFeature); 596feature = Unsafe.As<IBadRequestExceptionFeature?, TFeature?>(ref _currentIBadRequestExceptionFeature); 600feature = Unsafe.As<IHttpRequestTimeoutFeature?, TFeature?>(ref _currentIHttpRequestTimeoutFeature); 604feature = Unsafe.As<IHttp2StreamIdFeature?, TFeature?>(ref _currentIHttp2StreamIdFeature); 608feature = Unsafe.As<IHttpRequestLifetimeFeature?, TFeature?>(ref _currentIHttpRequestLifetimeFeature); 612feature = Unsafe.As<IHttpMaxRequestBodySizeFeature?, TFeature?>(ref _currentIHttpMaxRequestBodySizeFeature); 616feature = Unsafe.As<IHttpMinRequestBodyDataRateFeature?, TFeature?>(ref _currentIHttpMinRequestBodyDataRateFeature); 620feature = Unsafe.As<IHttpMinResponseDataRateFeature?, TFeature?>(ref _currentIHttpMinResponseDataRateFeature); 624feature = Unsafe.As<IHttpBodyControlFeature?, TFeature?>(ref _currentIHttpBodyControlFeature); 628feature = Unsafe.As<IHttpRequestBodyDetectionFeature?, TFeature?>(ref _currentIHttpRequestBodyDetectionFeature); 632feature = Unsafe.As<IHttpResetFeature?, TFeature?>(ref _currentIHttpResetFeature); 636feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 660_currentIHttpRequestFeature = Unsafe.As<TFeature?, IHttpRequestFeature?>(ref feature); 664_currentIHttpResponseFeature = Unsafe.As<TFeature?, IHttpResponseFeature?>(ref feature); 668_currentIHttpResponseBodyFeature = Unsafe.As<TFeature?, IHttpResponseBodyFeature?>(ref feature); 672_currentIRouteValuesFeature = Unsafe.As<TFeature?, IRouteValuesFeature?>(ref feature); 676_currentIEndpointFeature = Unsafe.As<TFeature?, IEndpointFeature?>(ref feature); 680_currentIServiceProvidersFeature = Unsafe.As<TFeature?, IServiceProvidersFeature?>(ref feature); 684_currentIHttpActivityFeature = Unsafe.As<TFeature?, IHttpActivityFeature?>(ref feature); 688_currentIHttpMetricsTagsFeature = Unsafe.As<TFeature?, IHttpMetricsTagsFeature?>(ref feature); 692_currentIItemsFeature = Unsafe.As<TFeature?, IItemsFeature?>(ref feature); 696_currentIQueryFeature = Unsafe.As<TFeature?, IQueryFeature?>(ref feature); 700_currentIRequestBodyPipeFeature = Unsafe.As<TFeature?, IRequestBodyPipeFeature?>(ref feature); 704_currentIFormFeature = Unsafe.As<TFeature?, IFormFeature?>(ref feature); 708_currentIHttpAuthenticationFeature = Unsafe.As<TFeature?, IHttpAuthenticationFeature?>(ref feature); 712_currentIHttpRequestIdentifierFeature = Unsafe.As<TFeature?, IHttpRequestIdentifierFeature?>(ref feature); 716_currentIHttpConnectionFeature = Unsafe.As<TFeature?, IHttpConnectionFeature?>(ref feature); 720_currentISessionFeature = Unsafe.As<TFeature?, ISessionFeature?>(ref feature); 724_currentIResponseCookiesFeature = Unsafe.As<TFeature?, IResponseCookiesFeature?>(ref feature); 728_currentIHttpRequestTrailersFeature = Unsafe.As<TFeature?, IHttpRequestTrailersFeature?>(ref feature); 732_currentIHttpResponseTrailersFeature = Unsafe.As<TFeature?, IHttpResponseTrailersFeature?>(ref feature); 736_currentITlsConnectionFeature = Unsafe.As<TFeature?, ITlsConnectionFeature?>(ref feature); 740_currentIHttpExtendedConnectFeature = Unsafe.As<TFeature?, IHttpExtendedConnectFeature?>(ref feature); 744_currentIHttpUpgradeFeature = Unsafe.As<TFeature?, IHttpUpgradeFeature?>(ref feature); 748_currentIHttpWebSocketFeature = Unsafe.As<TFeature?, IHttpWebSocketFeature?>(ref feature); 752_currentIHttpWebTransportFeature = Unsafe.As<TFeature?, IHttpWebTransportFeature?>(ref feature); 756_currentIBadRequestExceptionFeature = Unsafe.As<TFeature?, IBadRequestExceptionFeature?>(ref feature); 760_currentIHttpRequestTimeoutFeature = Unsafe.As<TFeature?, IHttpRequestTimeoutFeature?>(ref feature); 764_currentIHttp2StreamIdFeature = Unsafe.As<TFeature?, IHttp2StreamIdFeature?>(ref feature); 768_currentIHttpRequestLifetimeFeature = Unsafe.As<TFeature?, IHttpRequestLifetimeFeature?>(ref feature); 772_currentIHttpMaxRequestBodySizeFeature = Unsafe.As<TFeature?, IHttpMaxRequestBodySizeFeature?>(ref feature); 776_currentIHttpMinRequestBodyDataRateFeature = Unsafe.As<TFeature?, IHttpMinRequestBodyDataRateFeature?>(ref feature); 780_currentIHttpMinResponseDataRateFeature = Unsafe.As<TFeature?, IHttpMinResponseDataRateFeature?>(ref feature); 784_currentIHttpBodyControlFeature = Unsafe.As<TFeature?, IHttpBodyControlFeature?>(ref feature); 788_currentIHttpRequestBodyDetectionFeature = Unsafe.As<TFeature?, IHttpRequestBodyDetectionFeature?>(ref feature); 792_currentIHttpResetFeature = Unsafe.As<TFeature?, IHttpResetFeature?>(ref feature); 796_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature);
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
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 (28)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
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 (28)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
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 (52)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
src\Servers\Kestrel\shared\TransportMultiplexedConnection.Generated.cs (14)
202feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 206feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 210feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 214feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 218feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 222feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 226feature = Unsafe.As<ITlsConnectionFeature?, TFeature?>(ref _currentITlsConnectionFeature); 245_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 249_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 253_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 257_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 261_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 265_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 269_currentITlsConnectionFeature = Unsafe.As<TFeature?, ITlsConnectionFeature?>(ref feature);
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 (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (28)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
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 (11)
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
110ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\ServerInfrastructure\StringUtilities.cs (10)
195var vector = Unsafe.AsRef<Vector<sbyte>>(input); 203out Unsafe.AsRef<Vector<short>>(output), 204out Unsafe.AsRef<Vector<short>>(output + Vector<short>.Count)); 395var vector = Unsafe.AsRef<Vector<byte>>(input); 399out Unsafe.AsRef<Vector<ushort>>(output), 400out Unsafe.AsRef<Vector<ushort>>(output + Vector<ushort>.Count)); 430Unsafe.WriteUnaligned(output, Sse2.X64.ConvertToUInt64(vecWide)); 524Unsafe.WriteUnaligned( 525ref Unsafe.As<char, byte>( 526ref Unsafe.Add(ref MemoryMarshal.GetReference(buffer), i)),
Microsoft.Build.Framework (19)
ArraySortHelper.cs (2)
410Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 1298return Unsafe.AddByteOffset(
ImmutableSegmentedDictionary`2+PrivateInterlocked.cs (3)
19var dictionary = Volatile.Read(ref Unsafe.AsRef(in location._dictionary)); 28var dictionary = Interlocked.Exchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary); 37var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
ImmutableSegmentedList`1+PrivateInterlocked.cs (3)
19var list = Volatile.Read(ref Unsafe.AsRef(in location._list)); 28var list = Interlocked.Exchange(ref Unsafe.AsRef(in location._list), value._list); 37var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
RoslynUnsafe.cs (2)
16=> ref Unsafe.AsRef<T>(null); 26=> Unsafe.AsPointer(ref source) == null;
SegmentedArray`1.cs (1)
26/// <para>The segment size is calculated according to <see cref="Unsafe.SizeOf{T}"/>, performs the IL operation
SegmentedArrayHelper.cs (8)
29if (Unsafe.SizeOf<T>() == Unsafe.SizeOf<object>()) 42if (Unsafe.SizeOf<T>() == Unsafe.SizeOf<object>()) 55if (Unsafe.SizeOf<T>() == Unsafe.SizeOf<object>()) 138public static readonly int SegmentSize = CalculateSegmentSize(Unsafe.SizeOf<object>()); 145public static readonly int SegmentSize = CalculateSegmentSize(Unsafe.SizeOf<T>());
Microsoft.Extensions.Caching.Hybrid (7)
Internal\BufferChunk.cs (2)
68Unsafe.AsRef(in this) = default; // anti foot-shotgun double-return guard; not 100%, but worth doing 77Unsafe.AsRef(in copy._lengthAndPoolFlag) &= ~MSB;
Internal\DefaultHybridCache.cs (1)
53internal void DebugRemoveFeatures(CacheFeatures features) => Unsafe.AsRef(in _features) &= ~features;
Internal\DefaultHybridCache.L2.cs (2)
34var cache = Unsafe.As<IBufferDistributedCache>(_backendCache!); // type-checked already 98var cache = Unsafe.As<IBufferDistributedCache>(_backendCache!); // type-checked already
Internal\DefaultHybridCache.Serialization.cs (1)
28? Unsafe.As<IHybridCacheSerializer<T>>(serializer) : ResolveAndAddSerializer(this);
Internal\DefaultHybridCache.StampedeState.cs (1)
64protected static readonly WaitCallback SharedWaitCallback = static obj => Unsafe.As<StampedeState>(obj).Execute();
Microsoft.Extensions.Logging.EventSource (1)
LoggingEventSource.cs (1)
520eventData.DataPointer = (IntPtr)Unsafe.AsPointer(ref value);
Microsoft.Extensions.Primitives (11)
InplaceStringBuilder.cs (1)
105Unsafe.CopyBlockUnaligned(destination + _offset, source + offset, (uint)count * 2);
StringValues.cs (10)
109return Unsafe.As<string?[]>(value).Length; 150return Unsafe.As<string?[]>(value)[index]; // may throw 194string?[] values = Unsafe.As<string?[]>(value); 293return new[] { Unsafe.As<string>(value) }; 330return string.Equals(Unsafe.As<string>(value), item, StringComparison.Ordinal) ? 0 : -1; 384array[arrayIndex] = Unsafe.As<string>(value); 441return string.IsNullOrEmpty(Unsafe.As<string>(data)); 745return Unsafe.As<string>(this[0])?.GetHashCode() ?? Count.GetHashCode(); 756return Unsafe.As<string>(value)?.GetHashCode() ?? Count.GetHashCode(); 779_values = Unsafe.As<string?[]>(value);
Microsoft.NET.StringTools (2)
InternableString.cs (2)
249Unsafe.CopyBlockUnaligned(destPtr, sourcePtr, 2 * (uint)_inlineSpan.Length); 262Unsafe.CopyBlockUnaligned(destPtr, sourcePtr, 2 * (uint)span.Length);
PresentationCore (29)
MS\Internal\Interop\DWrite\IDWriteFactory.cs (11)
15return ((delegate* unmanaged<IDWriteFactory*, Guid*, void**, int>)(lpVtbl[0]))((IDWriteFactory*)Unsafe.AsPointer(ref this), riid, ppvObject); 20return ((delegate* unmanaged<IDWriteFactory*, uint>)(lpVtbl[1]))((IDWriteFactory*)Unsafe.AsPointer(ref this)); 25return ((delegate* unmanaged<IDWriteFactory*, uint>)(lpVtbl[2]))((IDWriteFactory*)Unsafe.AsPointer(ref this)); 30return ((delegate* unmanaged<IDWriteFactory*, IDWriteFontCollection**, int, int>)(lpVtbl[3]))((IDWriteFactory*)Unsafe.AsPointer(ref this), fontCollection, checkForUpdates); 35return ((delegate* unmanaged<IDWriteFactory*, IDWriteFontCollectionLoader*, void*, uint, IDWriteFontCollection**, int>)(lpVtbl[4]))((IDWriteFactory*)Unsafe.AsPointer(ref this), collectionLoader, collectionKey, collectionKeySize, fontCollection); 40return ((delegate* unmanaged<IDWriteFactory*, IDWriteFontCollectionLoader*, int>)(lpVtbl[5]))((IDWriteFactory*)Unsafe.AsPointer(ref this), fontCollectionLoader); 45return ((delegate* unmanaged<IDWriteFactory*, IDWriteFontCollectionLoader*, int>)(lpVtbl[6]))((IDWriteFactory*)Unsafe.AsPointer(ref this), fontCollectionLoader); 50return ((delegate* unmanaged<IDWriteFactory*, DWRITE_FONT_FACE_TYPE, uint, IDWriteFontFile**, uint, DWRITE_FONT_SIMULATIONS, IDWriteFontFace**, int>)(lpVtbl[9]))((IDWriteFactory*)Unsafe.AsPointer(ref this), fontFaceType, numberOfFiles, fontFiles, faceIndex, fontFaceSimulationFlags, fontFace); 55return ((delegate* unmanaged<IDWriteFactory*, IDWriteFontFileLoader*, int>)(lpVtbl[13]))((IDWriteFactory*)Unsafe.AsPointer(ref this), fontFileLoader); 60return ((delegate* unmanaged<IDWriteFactory*, IDWriteFontFileLoader*, int>)(lpVtbl[14]))((IDWriteFactory*)Unsafe.AsPointer(ref this), fontFileLoader); 65return ((delegate* unmanaged<IDWriteFactory*, IDWriteTextAnalyzer**, int>)(lpVtbl[21]))((IDWriteFactory*)Unsafe.AsPointer(ref this), textAnalyzer);
MS\Internal\Interop\DWrite\IDWriteFontCollection.cs (3)
15return ((delegate* unmanaged<IDWriteFontCollection*, Guid*, void**, int>)(lpVtbl[0]))((IDWriteFontCollection*)Unsafe.AsPointer(ref this), riid, ppvObject); 20return ((delegate* unmanaged<IDWriteFontCollection*, uint>)(lpVtbl[1]))((IDWriteFontCollection*)Unsafe.AsPointer(ref this)); 25return ((delegate* unmanaged<IDWriteFontCollection*, uint>)(lpVtbl[2]))((IDWriteFontCollection*)Unsafe.AsPointer(ref this));
MS\Internal\Interop\DWrite\IDWriteFontCollectionLoader.cs (3)
15return ((delegate* unmanaged<IDWriteFontCollectionLoader*, Guid*, void**, int>)(lpVtbl[0]))((IDWriteFontCollectionLoader*)Unsafe.AsPointer(ref this), riid, ppvObject); 20return ((delegate* unmanaged<IDWriteFontCollectionLoader*, uint>)(lpVtbl[1]))((IDWriteFontCollectionLoader*)Unsafe.AsPointer(ref this)); 25return ((delegate* unmanaged<IDWriteFontCollectionLoader*, uint>)(lpVtbl[2]))((IDWriteFontCollectionLoader*)Unsafe.AsPointer(ref this));
MS\Internal\Interop\DWrite\IDWriteFontFace.cs (3)
15return ((delegate* unmanaged<IDWriteFontFace*, Guid*, void**, int>)(lpVtbl[0]))((IDWriteFontFace*)Unsafe.AsPointer(ref this), riid, ppvObject); 20return ((delegate* unmanaged<IDWriteFontFace*, uint>)(lpVtbl[1]))((IDWriteFontFace*)Unsafe.AsPointer(ref this)); 25return ((delegate* unmanaged<IDWriteFontFace*, uint>)(lpVtbl[2]))((IDWriteFontFace*)Unsafe.AsPointer(ref this));
MS\Internal\Interop\DWrite\IDWriteFontFile.cs (3)
15return ((delegate* unmanaged<IDWriteFontFile*, Guid*, void**, int>)(lpVtbl[0]))((IDWriteFontFile*)Unsafe.AsPointer(ref this), riid, ppvObject); 20return ((delegate* unmanaged<IDWriteFontFile*, uint>)(lpVtbl[1]))((IDWriteFontFile*)Unsafe.AsPointer(ref this)); 25return ((delegate* unmanaged<IDWriteFontFile*, uint>)(lpVtbl[2]))((IDWriteFontFile*)Unsafe.AsPointer(ref this));
MS\Internal\Interop\DWrite\IDWriteFontFileLoader.cs (3)
15return ((delegate* unmanaged<IDWriteFontFileLoader*, Guid*, void**, int>)(lpVtbl[0]))((IDWriteFontFileLoader*)Unsafe.AsPointer(ref this), riid, ppvObject); 20return ((delegate* unmanaged<IDWriteFontFileLoader*, uint>)(lpVtbl[1]))((IDWriteFontFileLoader*)Unsafe.AsPointer(ref this)); 25return ((delegate* unmanaged<IDWriteFontFileLoader*, uint>)(lpVtbl[2]))((IDWriteFontFileLoader*)Unsafe.AsPointer(ref this));
MS\Internal\Interop\DWrite\IDWriteTextAnalyzer.cs (3)
15return ((delegate* unmanaged<IDWriteTextAnalyzer*, Guid*, void**, int>)(lpVtbl[0]))((IDWriteTextAnalyzer*)Unsafe.AsPointer(ref this), riid, ppvObject); 20return ((delegate* unmanaged<IDWriteTextAnalyzer*, uint>)(lpVtbl[1]))((IDWriteTextAnalyzer*)Unsafe.AsPointer(ref this)); 25return ((delegate* unmanaged<IDWriteTextAnalyzer*, uint>)(lpVtbl[2]))((IDWriteTextAnalyzer*)Unsafe.AsPointer(ref this));
System.Collections (1)
System\Collections\BitArray.cs (1)
136ref byte value = ref Unsafe.As<bool, byte>(ref MemoryMarshal.GetArrayDataReference<bool>(values));
System.Collections.Immutable (22)
System\Collections\Frozen\DefaultFrozenDictionary.cs (1)
41return ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\EmptyFrozenDictionary.cs (1)
29private protected override ref readonly TValue GetValueRefOrNullRefCore(TKey key) => ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\FrozenDictionary.cs (7)
438/// <remarks>The null reference can be detected by calling <see cref="Unsafe.IsNullRef"/>.</remarks> 462if (Unsafe.IsNullRef(ref Unsafe.AsRef(in valueRef))) 486!Unsafe.IsNullRef(ref Unsafe.AsRef(in GetValueRefOrNullRef(key))); 511if (!Unsafe.IsNullRef(ref Unsafe.AsRef(in valueRef)))
System\Collections\Frozen\Int32\Int32FrozenDictionary.cs (1)
79return ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\SmallFrozenDictionary.cs (1)
49return ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\SmallValueTypeComparableFrozenDictionary.cs (1)
67return ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\SmallValueTypeDefaultComparerFrozenDictionary.cs (1)
47return ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\String\LengthBucketsFrozenDictionary.cs (1)
110return ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.cs (1)
98return ref Unsafe.NullRef<TValue>();
System\Collections\Frozen\ValueTypeDefaultComparerFrozenDictionary.cs (1)
41return ref Unsafe.NullRef<TValue>();
System\Collections\Immutable\ImmutableInterlocked.cs (6)
125T[]? oldArray = Volatile.Read(ref Unsafe.AsRef(in location.array)); 135T[]? interlockedResult = Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), newImmutableArray.array, oldArray); 169T[]? oldArray = Volatile.Read(ref Unsafe.AsRef(in location.array)); 179T[]? interlockedResult = Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), newImmutableArray.array, oldArray); 199return new ImmutableArray<T>(Interlocked.Exchange(ref Unsafe.AsRef(in location.array), value.array)); 213return new ImmutableArray<T>(Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), value.array, comparand.array));
System.Diagnostics.DiagnosticSource (6)
System\Diagnostics\Activity.cs (2)
1911Unsafe.WriteUnaligned(ref outBytes[0], r.Next()); 1915Unsafe.WriteUnaligned(ref outBytes[8], r.Next());
System\Diagnostics\ActivityCreationOptions.cs (3)
122Unsafe.AsRef(in _samplerTags) = new ActivityTagsCollection(); 139Unsafe.AsRef(in _context) = new ActivityContext(id, default, ActivityTraceFlags.None); 159internal void SetTraceState(string? traceState) => Unsafe.AsRef(in _traceState) = traceState;
System\Diagnostics\Metrics\Instrument.netcore.cs (1)
59RecordMeasurement(measurement, MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AsRef(in tagList.Tag1), tagList.Count));
System.IO.Hashing (21)
System\IO\Hashing\Crc32.Arm.cs (4)
26Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref ptr, i))); 54Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref ptr, i)));
System\IO\Hashing\Crc32.Vectorized.cs (4)
52srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count * 4); 73srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count * 4); 91srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count); 101srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count);
System\IO\Hashing\Crc64.Vectorized.cs (4)
70srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count * 8); 103srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count * 8); 128srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count); 138srcRef = ref Unsafe.Add(ref srcRef, Vector128<byte>.Count);
System\IO\Hashing\XxHash128.cs (3)
223Unsafe.WriteUnaligned(ref dest0, high); 224Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest0, new IntPtr(sizeof(ulong))), low);
System\IO\Hashing\XxHash3.cs (1)
109Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), hash);
System\IO\Hashing\XxHashShared.cs (5)
785Unsafe.ReadUnaligned<uint>(data) : 786BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned<uint>(data)); 791Unsafe.ReadUnaligned<ulong>(data) : 792BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned<ulong>(data)); 801Unsafe.WriteUnaligned(data, value);
System.Linq (21)
System\Linq\Enumerable.cs (2)
52span = Unsafe.As<TSource[]>(source); 56span = CollectionsMarshal.AsSpan(Unsafe.As<List<TSource>>(source));
System\Linq\MaxMin.cs (12)
54ref T lastVectorStart = ref Unsafe.Add(ref current, span.Length - Vector128<T>.Count); 57current = ref Unsafe.Add(ref current, Vector128<T>.Count); 59while (Unsafe.IsAddressLessThan(ref current, ref lastVectorStart)) 62current = ref Unsafe.Add(ref current, Vector128<T>.Count); 78ref T lastVectorStart = ref Unsafe.Add(ref current, span.Length - Vector256<T>.Count); 81current = ref Unsafe.Add(ref current, Vector256<T>.Count); 83while (Unsafe.IsAddressLessThan(ref current, ref lastVectorStart)) 86current = ref Unsafe.Add(ref current, Vector256<T>.Count); 102ref T lastVectorStart = ref Unsafe.Add(ref current, span.Length - Vector512<T>.Count); 105current = ref Unsafe.Add(ref current, Vector512<T>.Count); 107while (Unsafe.IsAddressLessThan(ref current, ref lastVectorStart)) 110current = ref Unsafe.Add(ref current, Vector512<T>.Count);
System\Linq\Range.cs (6)
82ref int end = ref Unsafe.Add(ref pos, destination.Length); 91ref int oneVectorFromEnd = ref Unsafe.Subtract(ref end, Vector<int>.Count); 96pos = ref Unsafe.Add(ref pos, Vector<int>.Count); 98while (!Unsafe.IsAddressGreaterThan(ref pos, ref oneVectorFromEnd)); 103while (Unsafe.IsAddressLessThan(ref pos, ref end)) 106pos = ref Unsafe.Add(ref pos, 1);
System\Linq\Sum.cs (1)
185checked { result += Unsafe.Add(ref ptr, index); }
System.Memory (5)
System\Buffers\ReadOnlySequence.cs (1)
494ReadOnlySequence<char> charSequence = Unsafe.As<ReadOnlySequence<T>, ReadOnlySequence<char>>(ref localThis);
System\Buffers\ReadOnlySequence.Helpers.cs (1)
688return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<char, T>(ref MemoryMarshal.GetReference(spanOfChar)), spanOfChar.Length);
System\Buffers\SequenceReader.cs (1)
102Unsafe.AsRef(in _length) = Sequence.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 (8)
System\Net\Http\Headers\CacheControlHeaderValue.cs (2)
73Interlocked.Or(ref Unsafe.As<Flags, int>(ref _flags), (int)flag); 77Interlocked.And(ref Unsafe.As<Flags, int>(ref _flags), (int)~flag);
System\Net\Http\Headers\HttpHeaders.cs (6)
683if (Unsafe.IsNullRef(ref storeValueRef)) 698if (!Unsafe.IsNullRef(ref storeValueRef)) 1367ref object valueRef = ref Unsafe.NullRef<object>(); 1383valueRef = ref CollectionsMarshal.GetValueRefOrNullRef(Unsafe.As<Dictionary<HeaderDescriptor, object>>(store), key); 1488return !Unsafe.IsNullRef(ref GetValueRefOrNullRef(key)); 1528removed = Unsafe.As<Dictionary<HeaderDescriptor, object>>(store).Remove(key);
System.Net.Quic (2)
System\Net\Quic\Internal\ResettableValueTaskSource.cs (1)
58public bool IsCompleted => (State)Volatile.Read(ref Unsafe.As<State, byte>(ref _state)) == State.Completed;
System\Net\Quic\Internal\ValueTaskSource.cs (1)
41public bool IsCompleted => (State)Volatile.Read(ref Unsafe.As<State, byte>(ref _state)) == State.Completed;
System.Net.Sockets (2)
System\Net\Sockets\SocketAsyncContext.Unix.cs (1)
797QueueState state = (QueueState)Volatile.Read(ref Unsafe.As<QueueState, int>(ref _state));
System\Net\Sockets\SocketPal.Unix.cs (1)
209Unsafe.IsNullRef(ref MemoryMarshal.GetReference(buffer)) ? Array.Empty<byte>() : buffer;
System.Numerics.Tensors (623)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (117)
118result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, i))); 758result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 14))); 762result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 13))); 766result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 12))); 770result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 11))); 774result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 10))); 778result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 9))); 782result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 8))); 786result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 7))); 790result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 6))); 794result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 5))); 798result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 4))); 802result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 3))); 806result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 2))); 810result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 1))); 905result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 6))); 909result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 5))); 913result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 4))); 917result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 3))); 921result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 2))); 925result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 1))); 1003result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 2))); 1009result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, 1))); 1199result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, i), 1200Unsafe.Add(ref yRef, i))); 1912result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 14), Unsafe.Add(ref yRef, 14))); 1916result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 13), Unsafe.Add(ref yRef, 13))); 1920result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 12), Unsafe.Add(ref yRef, 12))); 1924result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 11), Unsafe.Add(ref yRef, 11))); 1928result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 10), Unsafe.Add(ref yRef, 10))); 1932result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 9), Unsafe.Add(ref yRef, 9))); 1936result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 8), Unsafe.Add(ref yRef, 8))); 1940result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 7), Unsafe.Add(ref yRef, 7))); 1944result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 6), Unsafe.Add(ref yRef, 6))); 1948result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 5), Unsafe.Add(ref yRef, 5))); 1952result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 4), Unsafe.Add(ref yRef, 4))); 1956result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 3), Unsafe.Add(ref yRef, 3))); 1960result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 2), Unsafe.Add(ref yRef, 2))); 1964result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 1), Unsafe.Add(ref yRef, 1))); 2065result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 6), Unsafe.Add(ref yRef, 6))); 2069result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 5), Unsafe.Add(ref yRef, 5))); 2073result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 4), Unsafe.Add(ref yRef, 4))); 2077result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 3), Unsafe.Add(ref yRef, 3))); 2081result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 2), Unsafe.Add(ref yRef, 2))); 2085result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 1), Unsafe.Add(ref yRef, 1))); 2169result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 2170Unsafe.Add(ref yRef, 2))); 2176result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 2177Unsafe.Add(ref yRef, 1))); 2281if (Unsafe.SizeOf<T>() == 1) 2284ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2288if (Unsafe.SizeOf<T>() == 2) 2291ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2295if (Unsafe.SizeOf<T>() == 4) 2298ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2302Debug.Assert(Unsafe.SizeOf<T>() == 8); 2305ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2317if (Unsafe.SizeOf<T>() == 1) 2320ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2324if (Unsafe.SizeOf<T>() == 2) 2327ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2331if (Unsafe.SizeOf<T>() == 4) 2334ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2338Debug.Assert(Unsafe.SizeOf<T>() == 8); 2341ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2353if (Unsafe.SizeOf<T>() == 1) 2356ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2360if (Unsafe.SizeOf<T>() == 2) 2363ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2367if (Unsafe.SizeOf<T>() == 4) 2370ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2374Debug.Assert(Unsafe.SizeOf<T>() == 8); 2377ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2389if (Unsafe.SizeOf<T>() == 1) 2392ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2396if (Unsafe.SizeOf<T>() == 2) 2399ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2403if (Unsafe.SizeOf<T>() == 4) 2406ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2410Debug.Assert(Unsafe.SizeOf<T>() == 8); 2413ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)), 2425if (Unsafe.SizeOf<T>() == 1) 2428ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2432if (Unsafe.SizeOf<T>() == 2) 2435ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2439if (Unsafe.SizeOf<T>() == 4) 2442ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2446Debug.Assert(Unsafe.SizeOf<T>() == 8); 2449ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)), 2461if (Unsafe.SizeOf<T>() == 1) 2464ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2468if (Unsafe.SizeOf<T>() == 2) 2471ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2475if (Unsafe.SizeOf<T>() == 4) 2478ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2482Debug.Assert(Unsafe.SizeOf<T>() == 8); 2485ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)),
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (119)
151Unsafe.Add(ref dRef, i) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, i), 152Unsafe.Add(ref yRef, i)); 1014Unsafe.Add(ref dRef, 14) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 14), 1015Unsafe.Add(ref yRef, 14)); 1019Unsafe.Add(ref dRef, 13) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 13), 1020Unsafe.Add(ref yRef, 13)); 1024Unsafe.Add(ref dRef, 12) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 12), 1025Unsafe.Add(ref yRef, 12)); 1029Unsafe.Add(ref dRef, 11) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 11), 1030Unsafe.Add(ref yRef, 11)); 1034Unsafe.Add(ref dRef, 10) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 10), 1035Unsafe.Add(ref yRef, 10)); 1039Unsafe.Add(ref dRef, 9) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 9), 1040Unsafe.Add(ref yRef, 9)); 1044Unsafe.Add(ref dRef, 8) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 8), 1045Unsafe.Add(ref yRef, 8)); 1049Unsafe.Add(ref dRef, 7) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 7), 1050Unsafe.Add(ref yRef, 7)); 1054Unsafe.Add(ref dRef, 6) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 1055Unsafe.Add(ref yRef, 6)); 1059Unsafe.Add(ref dRef, 5) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 1060Unsafe.Add(ref yRef, 5)); 1064Unsafe.Add(ref dRef, 4) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 1065Unsafe.Add(ref yRef, 4)); 1069Unsafe.Add(ref dRef, 3) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 1070Unsafe.Add(ref yRef, 3)); 1074Unsafe.Add(ref dRef, 2) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 1075Unsafe.Add(ref yRef, 2)); 1079Unsafe.Add(ref dRef, 1) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 1080Unsafe.Add(ref yRef, 1)); 1178Unsafe.Add(ref dRef, 6) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 1179Unsafe.Add(ref yRef, 6)); 1183Unsafe.Add(ref dRef, 5) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 1184Unsafe.Add(ref yRef, 5)); 1188Unsafe.Add(ref dRef, 4) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 1189Unsafe.Add(ref yRef, 4)); 1193Unsafe.Add(ref dRef, 3) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 1194Unsafe.Add(ref yRef, 3)); 1198Unsafe.Add(ref dRef, 2) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 1199Unsafe.Add(ref yRef, 2)); 1203Unsafe.Add(ref dRef, 1) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 1204Unsafe.Add(ref yRef, 1)); 1285Unsafe.Add(ref dRef, 2) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 1286Unsafe.Add(ref yRef, 2)); 1292Unsafe.Add(ref dRef, 1) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 1293Unsafe.Add(ref yRef, 1)); 1483Unsafe.Add(ref dRef, i) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, i)), 2338Unsafe.Add(ref dRef, 14) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 14)), 2343Unsafe.Add(ref dRef, 13) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 13)), 2348Unsafe.Add(ref dRef, 12) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 12)), 2353Unsafe.Add(ref dRef, 11) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 11)), 2358Unsafe.Add(ref dRef, 10) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 10)), 2363Unsafe.Add(ref dRef, 9) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 9)), 2368Unsafe.Add(ref dRef, 8) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 8)), 2373Unsafe.Add(ref dRef, 7) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 7)), 2378Unsafe.Add(ref dRef, 6) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 6)), 2383Unsafe.Add(ref dRef, 5) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 5)), 2388Unsafe.Add(ref dRef, 4) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 4)), 2393Unsafe.Add(ref dRef, 3) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 3)), 2398Unsafe.Add(ref dRef, 2) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 2)), 2403Unsafe.Add(ref dRef, 1) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 1)), 2506Unsafe.Add(ref dRef, 6) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 6)), 2511Unsafe.Add(ref dRef, 5) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 5)), 2516Unsafe.Add(ref dRef, 4) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 4)), 2521Unsafe.Add(ref dRef, 3) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 3)), 2526Unsafe.Add(ref dRef, 2) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 2)), 2531Unsafe.Add(ref dRef, 1) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 1)), 2617Unsafe.Add(ref dRef, 2) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 2)), 2624Unsafe.Add(ref dRef, 1) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, 1)), 2743if (Unsafe.SizeOf<T>() == 1) 2750else if (Unsafe.SizeOf<T>() == 2) 2756else if (Unsafe.SizeOf<T>() == 4) 2763Debug.Assert(Unsafe.SizeOf<T>() == 8);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IStatefulUnaryOperator.cs (46)
117Unsafe.Add(ref dRef, i) = op.Invoke(Unsafe.Add(ref xRef, i)); 880Unsafe.Add(ref dRef, 14) = op.Invoke(Unsafe.Add(ref xRef, 14)); 884Unsafe.Add(ref dRef, 13) = op.Invoke(Unsafe.Add(ref xRef, 13)); 888Unsafe.Add(ref dRef, 12) = op.Invoke(Unsafe.Add(ref xRef, 12)); 892Unsafe.Add(ref dRef, 11) = op.Invoke(Unsafe.Add(ref xRef, 11)); 896Unsafe.Add(ref dRef, 10) = op.Invoke(Unsafe.Add(ref xRef, 10)); 900Unsafe.Add(ref dRef, 9) = op.Invoke(Unsafe.Add(ref xRef, 9)); 904Unsafe.Add(ref dRef, 8) = op.Invoke(Unsafe.Add(ref xRef, 8)); 908Unsafe.Add(ref dRef, 7) = op.Invoke(Unsafe.Add(ref xRef, 7)); 912Unsafe.Add(ref dRef, 6) = op.Invoke(Unsafe.Add(ref xRef, 6)); 916Unsafe.Add(ref dRef, 5) = op.Invoke(Unsafe.Add(ref xRef, 5)); 920Unsafe.Add(ref dRef, 4) = op.Invoke(Unsafe.Add(ref xRef, 4)); 924Unsafe.Add(ref dRef, 3) = op.Invoke(Unsafe.Add(ref xRef, 3)); 928Unsafe.Add(ref dRef, 2) = op.Invoke(Unsafe.Add(ref xRef, 2)); 932Unsafe.Add(ref dRef, 1) = op.Invoke(Unsafe.Add(ref xRef, 1)); 1024Unsafe.Add(ref dRef, 6) = op.Invoke(Unsafe.Add(ref xRef, 6)); 1028Unsafe.Add(ref dRef, 5) = op.Invoke(Unsafe.Add(ref xRef, 5)); 1032Unsafe.Add(ref dRef, 4) = op.Invoke(Unsafe.Add(ref xRef, 4)); 1036Unsafe.Add(ref dRef, 3) = op.Invoke(Unsafe.Add(ref xRef, 3)); 1040Unsafe.Add(ref dRef, 2) = op.Invoke(Unsafe.Add(ref xRef, 2)); 1044Unsafe.Add(ref dRef, 1) = op.Invoke(Unsafe.Add(ref xRef, 1)); 1119Unsafe.Add(ref dRef, 2) = op.Invoke(Unsafe.Add(ref xRef, 2)); 1125Unsafe.Add(ref dRef, 1) = op.Invoke(Unsafe.Add(ref xRef, 1));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.ITernaryOperator.cs (230)
127Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 128Unsafe.Add(ref yRef, i), 129Unsafe.Add(ref zRef, i)); 1090Unsafe.Add(ref dRef, 14) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 14), 1091Unsafe.Add(ref yRef, 14), 1092Unsafe.Add(ref zRef, 14)); 1096Unsafe.Add(ref dRef, 13) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 13), 1097Unsafe.Add(ref yRef, 13), 1098Unsafe.Add(ref zRef, 13)); 1102Unsafe.Add(ref dRef, 12) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 12), 1103Unsafe.Add(ref yRef, 12), 1104Unsafe.Add(ref zRef, 12)); 1108Unsafe.Add(ref dRef, 11) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 11), 1109Unsafe.Add(ref yRef, 11), 1110Unsafe.Add(ref zRef, 11)); 1114Unsafe.Add(ref dRef, 10) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 10), 1115Unsafe.Add(ref yRef, 10), 1116Unsafe.Add(ref zRef, 10)); 1120Unsafe.Add(ref dRef, 9) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 9), 1121Unsafe.Add(ref yRef, 9), 1122Unsafe.Add(ref zRef, 9)); 1126Unsafe.Add(ref dRef, 8) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 8), 1127Unsafe.Add(ref yRef, 8), 1128Unsafe.Add(ref zRef, 8)); 1132Unsafe.Add(ref dRef, 7) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 7), 1133Unsafe.Add(ref yRef, 7), 1134Unsafe.Add(ref zRef, 7)); 1138Unsafe.Add(ref dRef, 6) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 1139Unsafe.Add(ref yRef, 6), 1140Unsafe.Add(ref zRef, 6)); 1144Unsafe.Add(ref dRef, 5) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 1145Unsafe.Add(ref yRef, 5), 1146Unsafe.Add(ref zRef, 5)); 1150Unsafe.Add(ref dRef, 4) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 1151Unsafe.Add(ref yRef, 4), 1152Unsafe.Add(ref zRef, 4)); 1156Unsafe.Add(ref dRef, 3) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 1157Unsafe.Add(ref yRef, 3), 1158Unsafe.Add(ref zRef, 3)); 1162Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 1163Unsafe.Add(ref yRef, 2), 1164Unsafe.Add(ref zRef, 2)); 1168Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 1169Unsafe.Add(ref yRef, 1), 1170Unsafe.Add(ref zRef, 1)); 1274Unsafe.Add(ref dRef, 6) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 1275Unsafe.Add(ref yRef, 6), 1276Unsafe.Add(ref zRef, 6)); 1280Unsafe.Add(ref dRef, 5) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 1281Unsafe.Add(ref yRef, 5), 1282Unsafe.Add(ref zRef, 5)); 1286Unsafe.Add(ref dRef, 4) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 1287Unsafe.Add(ref yRef, 4), 1288Unsafe.Add(ref zRef, 4)); 1292Unsafe.Add(ref dRef, 3) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 1293Unsafe.Add(ref yRef, 3), 1294Unsafe.Add(ref zRef, 3)); 1298Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 1299Unsafe.Add(ref yRef, 2), 1300Unsafe.Add(ref zRef, 2)); 1304Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 1305Unsafe.Add(ref yRef, 1), 1306Unsafe.Add(ref zRef, 1)); 1393Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 1394Unsafe.Add(ref yRef, 2), 1395Unsafe.Add(ref zRef, 2)); 1401Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 1402Unsafe.Add(ref yRef, 1), 1403Unsafe.Add(ref zRef, 1)); 1602Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 1603Unsafe.Add(ref yRef, i), 2557Unsafe.Add(ref dRef, 14) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 14), 2558Unsafe.Add(ref yRef, 14), 2563Unsafe.Add(ref dRef, 13) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 13), 2564Unsafe.Add(ref yRef, 13), 2569Unsafe.Add(ref dRef, 12) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 12), 2570Unsafe.Add(ref yRef, 12), 2575Unsafe.Add(ref dRef, 11) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 11), 2576Unsafe.Add(ref yRef, 11), 2581Unsafe.Add(ref dRef, 10) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 10), 2582Unsafe.Add(ref yRef, 10), 2587Unsafe.Add(ref dRef, 9) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 9), 2588Unsafe.Add(ref yRef, 9), 2593Unsafe.Add(ref dRef, 8) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 8), 2594Unsafe.Add(ref yRef, 8), 2599Unsafe.Add(ref dRef, 7) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 7), 2600Unsafe.Add(ref yRef, 7), 2605Unsafe.Add(ref dRef, 6) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 2606Unsafe.Add(ref yRef, 6), 2611Unsafe.Add(ref dRef, 5) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 2612Unsafe.Add(ref yRef, 5), 2617Unsafe.Add(ref dRef, 4) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 2618Unsafe.Add(ref yRef, 4), 2623Unsafe.Add(ref dRef, 3) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 2624Unsafe.Add(ref yRef, 3), 2629Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 2630Unsafe.Add(ref yRef, 2), 2635Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 2636Unsafe.Add(ref yRef, 1), 2745Unsafe.Add(ref dRef, 6) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 2746Unsafe.Add(ref yRef, 6), 2751Unsafe.Add(ref dRef, 5) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 2752Unsafe.Add(ref yRef, 5), 2757Unsafe.Add(ref dRef, 4) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 2758Unsafe.Add(ref yRef, 4), 2763Unsafe.Add(ref dRef, 3) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 2764Unsafe.Add(ref yRef, 3), 2769Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 2770Unsafe.Add(ref yRef, 2), 2775Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 2776Unsafe.Add(ref yRef, 1), 2868Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 2869Unsafe.Add(ref yRef, 2), 2876Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 2877Unsafe.Add(ref yRef, 1), 3081Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 3083Unsafe.Add(ref zRef, i)); 4036Unsafe.Add(ref dRef, 14) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 14), 4038Unsafe.Add(ref zRef, 14)); 4042Unsafe.Add(ref dRef, 13) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 13), 4044Unsafe.Add(ref zRef, 13)); 4048Unsafe.Add(ref dRef, 12) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 12), 4050Unsafe.Add(ref zRef, 12)); 4054Unsafe.Add(ref dRef, 11) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 11), 4056Unsafe.Add(ref zRef, 11)); 4060Unsafe.Add(ref dRef, 10) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 10), 4062Unsafe.Add(ref zRef, 10)); 4066Unsafe.Add(ref dRef, 9) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 9), 4068Unsafe.Add(ref zRef, 9)); 4072Unsafe.Add(ref dRef, 8) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 8), 4074Unsafe.Add(ref zRef, 8)); 4078Unsafe.Add(ref dRef, 7) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 7), 4080Unsafe.Add(ref zRef, 7)); 4084Unsafe.Add(ref dRef, 6) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 4086Unsafe.Add(ref zRef, 6)); 4090Unsafe.Add(ref dRef, 5) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 4092Unsafe.Add(ref zRef, 5)); 4096Unsafe.Add(ref dRef, 4) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 4098Unsafe.Add(ref zRef, 4)); 4102Unsafe.Add(ref dRef, 3) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 4104Unsafe.Add(ref zRef, 3)); 4108Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 4110Unsafe.Add(ref zRef, 2)); 4114Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 4116Unsafe.Add(ref zRef, 1)); 4224Unsafe.Add(ref dRef, 6) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 6), 4226Unsafe.Add(ref zRef, 6)); 4230Unsafe.Add(ref dRef, 5) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 5), 4232Unsafe.Add(ref zRef, 5)); 4236Unsafe.Add(ref dRef, 4) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 4), 4238Unsafe.Add(ref zRef, 4)); 4242Unsafe.Add(ref dRef, 3) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 3), 4244Unsafe.Add(ref zRef, 3)); 4248Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 4250Unsafe.Add(ref zRef, 2)); 4254Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 4256Unsafe.Add(ref zRef, 1)); 4347Unsafe.Add(ref dRef, 2) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 2), 4349Unsafe.Add(ref zRef, 2)); 4355Unsafe.Add(ref dRef, 1) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, 1), 4357Unsafe.Add(ref zRef, 1));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryInputBinaryOutput.cs (3)
139(T first, T second) = TUnaryOperator.Invoke(Unsafe.Add(ref sourceRef, i)); 140Unsafe.Add(ref destination1Ref, i) = first; 141Unsafe.Add(ref destination2Ref, i) = second;
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOneToTwoOperator.cs (2)
147Unsafe.Add(ref destinationRef, i) = TUnaryOperator.Invoke(Unsafe.Add(ref sourceRef, i));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOperator.cs (52)
93if (Vector512.IsHardwareAccelerated && Vector512<TInput>.IsSupported && Vector512<TOutput>.IsSupported && TUnaryOperator.Vectorizable && Unsafe.SizeOf<TInput>() == Unsafe.SizeOf<TOutput>()) 111if (Vector256.IsHardwareAccelerated && Vector256<TInput>.IsSupported && Vector256<TOutput>.IsSupported && TUnaryOperator.Vectorizable && Unsafe.SizeOf<TInput>() == Unsafe.SizeOf<TOutput>()) 129if (Vector128.IsHardwareAccelerated && Vector128<TInput>.IsSupported && Vector128<TOutput>.IsSupported && TUnaryOperator.Vectorizable && Unsafe.SizeOf<TInput>() == Unsafe.SizeOf<TOutput>()) 157Unsafe.Add(ref dRef, i) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, i)); 920Unsafe.Add(ref dRef, 14) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 14)); 924Unsafe.Add(ref dRef, 13) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 13)); 928Unsafe.Add(ref dRef, 12) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 12)); 932Unsafe.Add(ref dRef, 11) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 11)); 936Unsafe.Add(ref dRef, 10) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 10)); 940Unsafe.Add(ref dRef, 9) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 9)); 944Unsafe.Add(ref dRef, 8) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 8)); 948Unsafe.Add(ref dRef, 7) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 7)); 952Unsafe.Add(ref dRef, 6) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 6)); 956Unsafe.Add(ref dRef, 5) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 5)); 960Unsafe.Add(ref dRef, 4) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 4)); 964Unsafe.Add(ref dRef, 3) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 3)); 968Unsafe.Add(ref dRef, 2) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 2)); 972Unsafe.Add(ref dRef, 1) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 1)); 1064Unsafe.Add(ref dRef, 6) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 6)); 1068Unsafe.Add(ref dRef, 5) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 5)); 1072Unsafe.Add(ref dRef, 4) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 4)); 1076Unsafe.Add(ref dRef, 3) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 3)); 1080Unsafe.Add(ref dRef, 2) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 2)); 1084Unsafe.Add(ref dRef, 1) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 1)); 1159Unsafe.Add(ref dRef, 2) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 2)); 1165Unsafe.Add(ref dRef, 1) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, 1));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryTwoToOneOperator.cs (2)
147Unsafe.Add(ref destinationRef, i) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, i));
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan.cs (17)
111_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 200_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)startOffset /* force zero-extension */); 244_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)start /* force zero-extension */); 331return ref Unsafe.Add(ref _reference, index /* force zero-extension */); 354return ref Unsafe.Add(ref _reference, index /* force zero-extension */); 419Unsafe.AreSame(ref left._reference, ref right._reference); 459return new ReadOnlyTensorSpan<T>(ref Unsafe.As<TDerived, T>(ref items._reference), items._lengths, items._strides, items._memoryLength); 514ref T ret = ref Unsafe.NullRef<T>(); 553TensorSpanHelpers.Memmove(ref Unsafe.Add(ref slice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]); 599TensorSpanHelpers.Memmove(ref Unsafe.Add(ref slice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]); 692return new ReadOnlyTensorSpan<T>(ref Unsafe.Add(ref _reference, index), shape, _strides, _memoryLength - index); 720TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]); 760TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]);
System\Numerics\Tensors\netcore\TensorExtensions.cs (10)
60var sp = new ReadOnlyTensorSpan<T>(ref Unsafe.Add(ref span._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, span.Strides, span.Lengths)), [span.Lengths[span.Rank - 1]], [1], span.Lengths[span.Rank - 1]); 282TensorSpanHelpers.Memmove(ref Unsafe.Add(ref oslice._reference, TensorSpanHelpers.ComputeLinearIndex(oIndices, input.Strides, input.Lengths)), ref Unsafe.Add(ref islice._reference, TensorSpanHelpers.ComputeLinearIndex(iIndices, islice.Strides, islice.Lengths)), copyLength); 354TensorSpanHelpers.Memmove(ref Unsafe.Add(ref values, TensorSpanHelpers.ComputeLinearIndex(oIndices, input.Strides, input.Lengths)), ref Unsafe.Add(ref islice._reference, TensorSpanHelpers.ComputeLinearIndex(iIndices, islice.Strides, islice.Lengths)), copyLength); 431TensorSpanHelpers.Memmove(ref Unsafe.Add(ref oslice._reference, TensorSpanHelpers.ComputeLinearIndex(oIndices, outputs[0].Strides, outputs[0].Lengths)), ref Unsafe.Add(ref islice._reference, TensorSpanHelpers.ComputeLinearIndex(iIndices, islice.Strides, islice.Lengths)), copyLength); 2483ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref output._reference, outputOffset), (int)rowLength); 2496ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref output._reference, outputOffset), (int)rowLength); 2510ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref output._reference, outputOffset), (int)rowLength);
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertHelpers.cs (2)
270public static float Invoke(short x) => (float)Unsafe.BitCast<short, Half>(x); 451public static ushort Invoke(float x) => Unsafe.BitCast<Half, ushort>((Half)x);
System\Numerics\Tensors\netcore\TensorSpan.cs (18)
115_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 204_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)startOffset /* force zero-extension */); 248_reference = ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), (nint)(uint)start /* force zero-extension */); 333return ref Unsafe.Add(ref _reference, index /* force zero-extension */); 358return ref Unsafe.Add(ref _reference, index /* force zero-extension */); 425Unsafe.AreSame(ref left._reference, ref right._reference); 507ref T ret = ref Unsafe.NullRef<T>(); 534TensorSpanHelpers.Clear(ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), (nuint)Lengths[Rank - 1]); 555TensorSpanHelpers.Fill(ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), (nuint)Lengths[Rank - 1], value); 599TensorSpanHelpers.Memmove(ref Unsafe.Add(ref slice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, destination.Strides, Lengths)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]); 641TensorSpanHelpers.Memmove(ref Unsafe.Add(ref slice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]); 733return new TensorSpan<T>(ref Unsafe.Add(ref _reference, index), lengths, _strides, _memoryLength - index); 761TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]); 801TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[Rank - 1]);
System\Numerics\Tensors\netcore\TensorSpanHelpers.T.cs (4)
45dest = ref Unsafe.Add(ref dest, toClear); 56dest = ref Unsafe.Add(ref dest, toFill); 68first = ref Unsafe.Add(ref first, toCompare); 69second = ref Unsafe.Add(ref second, toCompare);
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (1)
20if (!Unsafe.AreSame(ref MemoryMarshal.GetReference(input), ref MemoryMarshal.GetReference(output)) &&
System.Private.CoreLib (3770)
src\libraries\Common\src\System\HexConverter.cs (6)
117ref ushort destRef = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars)); 138uint i32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref srcRef, pos)); 255ref ushort srcRef = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars)); 307Unsafe.WriteUnaligned(ref Unsafe.Add(ref destRef, offset / 2), output.AsUInt64().ToScalar());
src\libraries\Common\src\System\Number.NumberBuffer.cs (1)
53DigitsPtr = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(digits)); // Safe since memory must be fixed
src\libraries\System.Private.CoreLib\src\System\Array.cs (39)
374ref byte src = ref Unsafe.As<RawArrayData>(sourceArray).Data; 375ref byte dst = ref Unsafe.As<RawArrayData>(destinationArray).Data; 405ref byte src = ref Unsafe.AddByteOffset(ref Unsafe.As<RawArrayData>(sourceArray).Data, (uint)sourceIndex * elementSize); 406ref byte dst = ref Unsafe.AddByteOffset(ref Unsafe.As<RawArrayData>(destinationArray).Data, (uint)destinationIndex * elementSize); 958=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).BinarySearch(Unsafe.As<byte, T>(ref value.GetRawData())); 1131ref T first = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)startIndex); 1457=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).IndexOf(Unsafe.As<byte, T>(ref value.GetRawData())); 1524ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1525Unsafe.As<T, byte>(ref value), 1532ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1533Unsafe.As<T, short>(ref value), 1540ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1541Unsafe.As<T, int>(ref value), 1548ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1549Unsafe.As<T, long>(ref value), 1687=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).LastIndexOf(Unsafe.As<byte, T>(ref value.GetRawData())); 1772ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1773Unsafe.As<T, byte>(ref value), 1782ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1783Unsafe.As<T, short>(ref value), 1792ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1793Unsafe.As<T, int>(ref value), 1802ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 1803Unsafe.As<T, long>(ref value), 1925SpanHelpers.Reverse(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), (nuint)length); 2179var span = new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), length); 2203var spanKeys = new Span<TKey>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(keys), index), length); 2204var spanItems = new Span<TValue>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(items), index), length); 2692new 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 (51)
50Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value ? (byte)1 : (byte)0); 62Unsafe.As<byte, char>(ref bytes[0]) = value; 77Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 89Unsafe.As<byte, short>(ref bytes[0]) = value; 104Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 116Unsafe.As<byte, int>(ref bytes[0]) = value; 131Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 143Unsafe.As<byte, long>(ref bytes[0]) = value; 158Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 170Unsafe.As<byte, Int128>(ref bytes[0]) = value; 185Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 198Unsafe.As<byte, ushort>(ref bytes[0]) = value; 214Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 227Unsafe.As<byte, uint>(ref bytes[0]) = value; 243Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 256Unsafe.As<byte, ulong>(ref bytes[0]) = value; 272Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 285Unsafe.As<byte, UInt128>(ref bytes[0]) = value; 301Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 313Unsafe.As<byte, Half>(ref bytes[0]) = value; 328Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 340Unsafe.As<byte, float>(ref bytes[0]) = value; 355Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 367Unsafe.As<byte, double>(ref bytes[0]) = value; 382Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 408return Unsafe.ReadUnaligned<char>(ref MemoryMarshal.GetReference(value)); 429return Unsafe.ReadUnaligned<short>(ref value[startIndex]); 443return Unsafe.ReadUnaligned<short>(ref MemoryMarshal.GetReference(value)); 467return Unsafe.ReadUnaligned<int>(ref value[startIndex]); 481return Unsafe.ReadUnaligned<int>(ref MemoryMarshal.GetReference(value)); 505return Unsafe.ReadUnaligned<long>(ref value[startIndex]); 519return Unsafe.ReadUnaligned<long>(ref MemoryMarshal.GetReference(value)); 543return Unsafe.ReadUnaligned<Int128>(ref value[startIndex]); 557return Unsafe.ReadUnaligned<Int128>(ref MemoryMarshal.GetReference(value)); 584return Unsafe.ReadUnaligned<ushort>(ref MemoryMarshal.GetReference(value)); 614return Unsafe.ReadUnaligned<uint>(ref MemoryMarshal.GetReference(value)); 644return Unsafe.ReadUnaligned<ulong>(ref MemoryMarshal.GetReference(value)); 669return Unsafe.ReadUnaligned<UInt128>(ref value[startIndex]); 684return Unsafe.ReadUnaligned<UInt128>(ref MemoryMarshal.GetReference(value)); 709return Unsafe.ReadUnaligned<Half>(ref MemoryMarshal.GetReference(value)); 737return Unsafe.ReadUnaligned<float>(ref MemoryMarshal.GetReference(value)); 765return Unsafe.ReadUnaligned<double>(ref MemoryMarshal.GetReference(value)); 891return Unsafe.ReadUnaligned<byte>(ref MemoryMarshal.GetReference(value)) != 0; 900public static unsafe long DoubleToInt64Bits(double value) => Unsafe.BitCast<double, long>(value); 908public static unsafe double Int64BitsToDouble(long value) => Unsafe.BitCast<long, double>(value); 916public static unsafe int SingleToInt32Bits(float value) => Unsafe.BitCast<float, int>(value); 924public static unsafe float Int32BitsToSingle(int value) => Unsafe.BitCast<int, float>(value); 949public static unsafe ulong DoubleToUInt64Bits(double value) => Unsafe.BitCast<double, ulong>(value); 958public static unsafe double UInt64BitsToDouble(ulong value) => Unsafe.BitCast<ulong, double>(value); 967public static unsafe uint SingleToUInt32Bits(float value) => Unsafe.BitCast<float, uint>(value); 976public static unsafe float UInt32BitsToSingle(uint value) => Unsafe.BitCast<uint, float>(value);
src\libraries\System.Private.CoreLib\src\System\Buffer.cs (14)
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; 158ref Unsafe.As<T, byte>(ref destination), 159ref Unsafe.As<T, byte>(ref source), 166ref Unsafe.As<T, byte>(ref destination), 167ref Unsafe.As<T, byte>(ref source), 197if (Unsafe.AreSame(ref source, ref destination)) 201if ((nuint)(nint)Unsafe.ByteOffset(ref source, ref destination) >= byteCount) 208destination = ref Unsafe.AddByteOffset(ref destination, BulkMoveWithWriteBarrierChunk); 209source = ref Unsafe.AddByteOffset(ref source, BulkMoveWithWriteBarrierChunk); 219__BulkMoveWithWriteBarrier(ref Unsafe.AddByteOffset(ref destination, byteCount), ref Unsafe.AddByteOffset(ref source, byteCount), BulkMoveWithWriteBarrierChunk);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (6)
297if (Unsafe.AreSame(ref sourceRef, ref destRef) || 328Unsafe.Add(ref destRef, i) = TReverser.Reverse(Unsafe.Add(ref sourceRef, i)); 361Unsafe.Add(ref destRef, i) = TReverser.Reverse(Unsafe.Add(ref sourceRef, i)); 386if (Unsafe.AreSame(ref MemoryMarshal.GetReference(source), ref MemoryMarshal.GetReference(destination)) ||
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (3)
63buffer = Unsafe.As<T[]?>(tlsBuckets[bucketIndex].Array); 82buffer = Unsafe.As<T[]?>(b.TryPop()); 408Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(arrays), count) = array; // arrays[count] = array, but avoiding stelemref
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64.cs (2)
14int vectorElements = Unsafe.SizeOf<TVector>(); 28int vectorElements = Unsafe.SizeOf<TVector>();
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (15)
179int i0 = Unsafe.Add(ref decodingMap, (IntPtr)t0); 180int i1 = Unsafe.Add(ref decodingMap, (IntPtr)t1); 191int i2 = Unsafe.Add(ref decodingMap, (IntPtr)t2); 192int i3 = Unsafe.Add(ref decodingMap, (IntPtr)t3); 213int i2 = Unsafe.Add(ref decodingMap, (IntPtr)t2); 408int i0 = Unsafe.Add(ref decodingMap, t0); 409int i1 = Unsafe.Add(ref decodingMap, t1); 418int i2 = Unsafe.Add(ref decodingMap, t2); 419int i3 = Unsafe.Add(ref decodingMap, t3); 436int i2 = Unsafe.Add(ref decodingMap, t2); 566if (Unsafe.Subtract(ref ptrToLastElement, 1) == EncodingPad) padding++; 1176int i0 = Unsafe.Add(ref decodingMap, t0); 1177int i1 = Unsafe.Add(ref decodingMap, t1); 1178int i2 = Unsafe.Add(ref decodingMap, t2); 1179int i3 = Unsafe.Add(ref decodingMap, t3);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Encoder.cs (14)
114Unsafe.WriteUnaligned(dest, result); 133Unsafe.WriteUnaligned(dest, result); 140Unsafe.WriteUnaligned(dest, result); 225Unsafe.WriteUnaligned(bufferBytes + destinationIndex, result); 233Unsafe.WriteUnaligned(bufferBytes + destinationIndex, result); 683uint i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 18)); 684uint i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 12) & 0x3F)); 685uint i2 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 6) & 0x3F)); 686uint i3 = Unsafe.Add(ref encodingMap, (IntPtr)(i & 0x3F)); 706uint i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 18)); 707uint i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 12) & 0x3F)); 708uint i2 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 6) & 0x3F)); 727uint i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 10)); 728uint i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 4) & 0x3F));
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (4)
28uint index = Unsafe.Add(ref MemoryMarshal.GetReference(log2ToPow10), BitOperations.Log2(value)); 56ulong powerOf10 = Unsafe.Add(ref MemoryMarshal.GetReference(powersOf10), index); 61return (int)(index - Unsafe.As<bool, byte>(ref lessThan)); // while arbitrary bools may be non-0/1, comparison operators are expected to return 0/1 106long tableValue = Unsafe.Add(ref MemoryMarshal.GetReference(table), uint.Log2(value));
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\ParserHelpers.cs (2)
65Unsafe.SkipInit(out value); // bypass language initialization rules since we're about to throw 66Unsafe.SkipInit(out bytesConsumed);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Signed.cs (8)
58Unsafe.SkipInit(out value); // will be populated by TryParseByteX 59return TryParseByteX(source, out Unsafe.As<sbyte, byte>(ref value), out bytesConsumed); 110Unsafe.SkipInit(out value); // will be populated by TryParseUInt16X 111return TryParseUInt16X(source, out Unsafe.As<short, ushort>(ref value), out bytesConsumed); 162Unsafe.SkipInit(out value); // will be populated by TryParseUInt32X 163return TryParseUInt32X(source, out Unsafe.As<int, uint>(ref value), out bytesConsumed); 214Unsafe.SkipInit(out value); // will be populated by TryParseUInt64X 215return TryParseUInt64X(source, out Unsafe.As<long, ulong>(ref value), out bytesConsumed);
src\libraries\System.Private.CoreLib\src\System\ByReference.cs (1)
17public static ByReference Create<T>(ref T p) => new ByReference(ref Unsafe.As<T, byte>(ref p));
src\libraries\System.Private.CoreLib\src\System\Byte.cs (1)
322result = Unsafe.Add(ref MemoryMarshal.GetReference(source), source.Length - sizeof(byte));
src\libraries\System.Private.CoreLib\src\System\Char.cs (5)
1206sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(char)); 1209result = Unsafe.ReadUnaligned<char>(ref sourceRef); 1257result = Unsafe.ReadUnaligned<char>(ref sourceRef); 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 (21)
401Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 464ref T lastRef = ref Unsafe.Add(ref zeroRef, keys.Length - 1); 465ref T middleRef = ref Unsafe.Add(ref zeroRef, (keys.Length - 1) >> 1); 471ref T nextToLastRef = ref Unsafe.Add(ref zeroRef, keys.Length - 2); 477while (Unsafe.IsAddressLessThan(ref leftRef, ref rightRef)) 481while (Unsafe.IsAddressLessThan(ref leftRef, ref nextToLastRef) && (leftRef = ref Unsafe.Add(ref leftRef, 1)) == null) ; 482while (Unsafe.IsAddressGreaterThan(ref rightRef, ref zeroRef) && (rightRef = ref Unsafe.Add(ref rightRef, -1)) != null) ; 486while (Unsafe.IsAddressLessThan(ref leftRef, ref nextToLastRef) && GreaterThan(ref pivot, ref leftRef = ref Unsafe.Add(ref leftRef, 1))) ; 487while (Unsafe.IsAddressGreaterThan(ref rightRef, ref zeroRef) && LessThan(ref pivot, ref rightRef = ref Unsafe.Add(ref rightRef, -1))) ; 490if (!Unsafe.IsAddressLessThan(ref leftRef, ref rightRef)) 499if (!Unsafe.AreSame(ref leftRef, ref nextToLastRef)) 504return (int)((nint)Unsafe.ByteOffset(ref zeroRef, ref leftRef) / sizeof(T)); 550T t = Unsafe.Add(ref MemoryMarshal.GetReference(keys), i + 1); 553while (j >= 0 && (t == null || LessThan(ref t, ref Unsafe.Add(ref MemoryMarshal.GetReference(keys), j)))) 555Unsafe.Add(ref MemoryMarshal.GetReference(keys), j + 1) = Unsafe.Add(ref MemoryMarshal.GetReference(keys), j); 559Unsafe.Add(ref MemoryMarshal.GetReference(keys), j + 1) = t!;
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Dictionary.cs (9)
233if (!Unsafe.IsNullRef(ref value)) 260if (!Unsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 271if (!Unsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 298!Unsafe.IsNullRef(ref FindValue(key)); 404ref Entry entry = ref Unsafe.NullRef<Entry>(); 484value = ref Unsafe.NullRef<TValue>(); 764Debug.Assert(!Unsafe.IsNullRef(ref value), "the lookup result cannot be a null ref here"); 1020if (!Unsafe.IsNullRef(ref valRef)) 1226if (!Unsafe.IsNullRef(ref value))
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\HashSet.cs (1)
1103ref int bucket = ref Unsafe.NullRef<int>();
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (1)
68ref Unsafe.As<char, byte>(ref obj.GetRawStringData()),
src\libraries\System.Private.CoreLib\src\System\ComAwareWeakReference.cs (4)
146return Unsafe.As<ComAwareWeakReference>(GCHandle.InternalGet(taggedHandle & ~HandleTagBits)); 153return Unsafe.As<ComAwareWeakReference>(GCHandle.InternalGet(taggedHandle & ~HandleTagBits)).Target; 159return Unsafe.As<ComAwareWeakReference>(GCHandle.InternalGet(taggedHandle & ~HandleTagBits))._weakHandle; 167Unsafe.As<ComAwareWeakReference>(GCHandle.InternalGet(taggedHandle & ~HandleTagBits));
src\libraries\System.Private.CoreLib\src\System\Convert.Base64.cs (24)
64int result = Decode(ref Unsafe.Add(ref srcChars, sourceIndex), ref decodingMap); 67WriteThreeLowOrderBytes(ref Unsafe.Add(ref destBytes, destIndex), result); 82int i0 = Unsafe.Add(ref srcChars, srcLength - 4); 83int i1 = Unsafe.Add(ref srcChars, srcLength - 3); 84int i2 = Unsafe.Add(ref srcChars, srcLength - 2); 85int i3 = Unsafe.Add(ref srcChars, srcLength - 1); 89i0 = Unsafe.Add(ref decodingMap, i0); 90i1 = Unsafe.Add(ref decodingMap, i1); 99i2 = Unsafe.Add(ref decodingMap, i2); 100i3 = Unsafe.Add(ref decodingMap, i3); 111WriteThreeLowOrderBytes(ref Unsafe.Add(ref destBytes, destIndex), i0); 116i2 = Unsafe.Add(ref decodingMap, i2); 126Unsafe.Add(ref destBytes, destIndex) = (byte)(i0 >> 16); 127Unsafe.Add(ref destBytes, destIndex + 1) = (byte)(i0 >> 8); 136Unsafe.Add(ref destBytes, destIndex) = (byte)(i0 >> 16); 161int i1 = Unsafe.Add(ref encodedChars, 1); 162int i2 = Unsafe.Add(ref encodedChars, 2); 163int i3 = Unsafe.Add(ref encodedChars, 3); 168i0 = Unsafe.Add(ref decodingMap, i0); 169i1 = Unsafe.Add(ref decodingMap, i1); 170i2 = Unsafe.Add(ref decodingMap, i2); 171i3 = Unsafe.Add(ref decodingMap, i3); 188Unsafe.Add(ref destination, 1) = (byte)(value >> 8); 189Unsafe.Add(ref destination, 2) = (byte)value;
src\libraries\System.Private.CoreLib\src\System\Convert.cs (21)
2488ref ushort dest = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars)); 2489ref byte src = ref Unsafe.As<ushort, byte>(ref dest); 2495dest = ref Unsafe.Add(ref dest, charLengthRequired); 2496src = ref Unsafe.Add(ref src, charLengthRequired); 2501ref byte srcBeginningPlus31 = ref Unsafe.Add(ref srcBeginning, 31); 2502while (Unsafe.IsAddressGreaterThan(ref src, ref srcBeginningPlus31)) 2504src = ref Unsafe.Subtract(ref src, 32); 2505dest = ref Unsafe.Subtract(ref dest, 32); 2517ref byte srcBeginningPlus15 = ref Unsafe.Add(ref srcBeginning, 15); 2518while (Unsafe.IsAddressGreaterThan(ref src, ref srcBeginningPlus15)) 2520src = ref Unsafe.Subtract(ref src, 16); 2521dest = ref Unsafe.Subtract(ref dest, 16); 2531ref byte srcBeginningPlus3 = ref Unsafe.Add(ref srcBeginning, 3); 2532while (Unsafe.IsAddressGreaterThan(ref src, ref srcBeginningPlus3)) 2534dest = ref Unsafe.Subtract(ref dest, 4); 2535src = ref Unsafe.Subtract(ref src, 4); 2536Ascii.WidenFourAsciiBytesToUtf16AndWriteToBuffer(ref Unsafe.As<ushort, char>(ref dest), Unsafe.ReadUnaligned<uint>(ref src)); 2543Debug.Assert(Unsafe.AreSame(ref srcBeginning, ref src)); 2544Debug.Assert(Unsafe.AreSame(ref srcBeginning, ref Unsafe.As<ushort, byte>(ref dest)),
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (8)
1150Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1168Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1196Unsafe.WriteUnaligned(ref address, hi32); 1197Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref address, sizeof(uint)), lo64); 1225Unsafe.WriteUnaligned(ref address, lo64); 1226Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref address, sizeof(ulong)), hi32);
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (11)
22private static ref DecCalc AsMutable(ref decimal d) => ref Unsafe.As<decimal, DecCalc>(ref d); 961Unsafe.SkipInit(out Buf24 bufNum); 1309Unsafe.SkipInit(out Buf24 bufProd); 1883Unsafe.SkipInit(out Buf12 bufQuo); 1983Unsafe.SkipInit(out Buf16 bufRem); 2051Unsafe.SkipInit(out Buf12 bufDivisor); 2165int cmp = VarDecCmpSub(in Unsafe.As<DecCalc, decimal>(ref d1), in Unsafe.As<DecCalc, decimal>(ref d2)); 2203Unsafe.SkipInit(out Buf12 bufQuo); 2262Unsafe.SkipInit(out Buf28 b); 2316Unsafe.SkipInit(out Buf12 bufDivisor);
src\libraries\System.Private.CoreLib\src\System\Delegate.cs (3)
81public bool HasSingleTarget => Unsafe.As<MulticastDelegate>(this).HasSingleTarget; 94=> new InvocationListEnumerator<TDelegate>(Unsafe.As<MulticastDelegate>(d)); 126if ((_current = Unsafe.As<TDelegate>(_delegate?.TryGetAt(index))) == null)
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 (116)
185if (Unsafe.SizeOf<TStorage>() <= sizeof(uint)) 423ushort flagsValue = Unsafe.As<byte, ushort>(ref pFlagsValue); 424return (Unsafe.As<byte, ushort>(ref pThisValue) & flagsValue) == flagsValue; 430uint flagsValue = Unsafe.As<byte, uint>(ref pFlagsValue); 431return (Unsafe.As<byte, uint>(ref pThisValue) & flagsValue) == flagsValue; 437ulong flagsValue = Unsafe.As<byte, ulong>(ref pFlagsValue); 438return (Unsafe.As<byte, ulong>(ref pThisValue) & flagsValue) == flagsValue; 892Unsafe.SkipInit(out result); 896if (underlyingType == typeof(sbyte)) return TryParseByValueOrName<sbyte, byte>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, sbyte>(ref result)); 897if (underlyingType == typeof(byte)) return TryParseByValueOrName<byte, byte>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, byte>(ref result)); 898if (underlyingType == typeof(short)) return TryParseByValueOrName<short, ushort>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, short>(ref result)); 899if (underlyingType == typeof(ushort)) return TryParseByValueOrName<ushort, ushort>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, ushort>(ref result)); 900if (underlyingType == typeof(int)) return TryParseByValueOrName<int, uint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, int>(ref result)); 901if (underlyingType == typeof(uint)) return TryParseByValueOrName<uint, uint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, uint>(ref result)); 902if (underlyingType == typeof(long)) return TryParseByValueOrName<long, ulong>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, long>(ref result)); 903if (underlyingType == typeof(ulong)) return TryParseByValueOrName<ulong, ulong>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, ulong>(ref result)); 905if (underlyingType == typeof(nint)) return TryParseRareTypeByValueOrName<nint, nuint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, nint>(ref result)); 906if (underlyingType == typeof(nuint)) return TryParseRareTypeByValueOrName<nuint, nuint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, nuint>(ref result)); 907if (underlyingType == typeof(float)) return TryParseRareTypeByValueOrName<float, float>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, float>(ref result)); 908if (underlyingType == typeof(double)) return TryParseRareTypeByValueOrName<double, double>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, double>(ref result)); 909if (underlyingType == typeof(char)) return TryParseRareTypeByValueOrName<char, char>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, char>(ref result)); 939Unsafe.SkipInit(out result); 940return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 954Unsafe.SkipInit(out result); 955return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 997Unsafe.SkipInit(out result); 998return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 1021Unsafe.SkipInit(out result); 1022return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 1171CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data), 1173CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data), 1174CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data), 1175CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data), 1176CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data), 1177CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data), 1178CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data), 1180CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data), 1181CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data), 1182CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data), 1183CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data), 1184CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data), 1185CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data), 1214return Unsafe.As<byte, ushort>(ref pThisValue) == Unsafe.As<byte, ushort>(ref pOtherValue); 1218return Unsafe.As<byte, uint>(ref pThisValue) == Unsafe.As<byte, uint>(ref pOtherValue); 1222return Unsafe.As<byte, ulong>(ref pThisValue) == Unsafe.As<byte, ulong>(ref pOtherValue); 1261CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data).GetHashCode(), 1263CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data).GetHashCode(), 1264CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data).GetHashCode(), 1265CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data).GetHashCode(), 1266CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data).GetHashCode(), 1267CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data).GetHashCode(), 1268CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data).GetHashCode(), 1270CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data).GetHashCode(), 1271CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data).GetHashCode(), 1272CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data).GetHashCode(), 1273CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data).GetHashCode(), 1274CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data).GetHashCode(), 1275CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data).GetHashCode(), 1299return Unsafe.As<byte, sbyte>(ref pThisValue).CompareTo(Unsafe.As<byte, sbyte>(ref pTargetValue)); 1305return Unsafe.As<byte, short>(ref pThisValue).CompareTo(Unsafe.As<byte, short>(ref pTargetValue)); 1308return Unsafe.As<byte, ushort>(ref pThisValue).CompareTo(Unsafe.As<byte, ushort>(ref pTargetValue)); 1311return Unsafe.As<byte, int>(ref pThisValue).CompareTo(Unsafe.As<byte, int>(ref pTargetValue)); 1314return Unsafe.As<byte, uint>(ref pThisValue).CompareTo(Unsafe.As<byte, uint>(ref pTargetValue)); 1317return Unsafe.As<byte, long>(ref pThisValue).CompareTo(Unsafe.As<byte, long>(ref pTargetValue)); 1320return Unsafe.As<byte, ulong>(ref pThisValue).CompareTo(Unsafe.As<byte, ulong>(ref pTargetValue)); 1324return Unsafe.As<byte, float>(ref pThisValue).CompareTo(Unsafe.As<byte, float>(ref pTargetValue)); 1327return Unsafe.As<byte, double>(ref pThisValue).CompareTo(Unsafe.As<byte, double>(ref pTargetValue)); 1471TStorage value = Unsafe.As<byte, TStorage>(ref rawData); 1478return result ?? Unsafe.BitCast<TStorage, TUnderlying>(value).ToString()!; 1501TStorage value = Unsafe.As<byte, TStorage>(ref rawData); 1516result = Unsafe.BitCast<TStorage, TUnderlying>(value).ToString()!; 1544return string.Create(Unsafe.SizeOf<TStorage>() * 2, (IntPtr)ptr, (destination, intptr) => 1548Debug.Assert(charsWritten == Unsafe.SizeOf<TStorage>() * 2); 1557if (Unsafe.SizeOf<TStorage>() * 2 <= destination.Length) 1568ushort value = Unsafe.As<byte, ushort>(ref data); 1579uint value = Unsafe.As<byte, uint>(ref data); 1592ulong value = Unsafe.As<byte, ulong>(ref data); 1607charsWritten = Unsafe.SizeOf<TStorage>() * 2; 1701CorElementType.ELEMENT_TYPE_I2 => TryFormatPrimitiveDefault<short, ushort>(enumType, Unsafe.As<byte, short>(ref rawData), destination, out charsWritten), 1702CorElementType.ELEMENT_TYPE_U2 => TryFormatPrimitiveDefault<ushort, ushort>(enumType, Unsafe.As<byte, ushort>(ref rawData), destination, out charsWritten), 1703CorElementType.ELEMENT_TYPE_I4 => TryFormatPrimitiveDefault<int, uint>(enumType, Unsafe.As<byte, int>(ref rawData), destination, out charsWritten), 1704CorElementType.ELEMENT_TYPE_U4 => TryFormatPrimitiveDefault<uint, uint>(enumType, Unsafe.As<byte, uint>(ref rawData), destination, out charsWritten), 1705CorElementType.ELEMENT_TYPE_I8 => TryFormatPrimitiveDefault<long, ulong>(enumType, Unsafe.As<byte, long>(ref rawData), destination, out charsWritten), 1706CorElementType.ELEMENT_TYPE_U8 => TryFormatPrimitiveDefault<ulong, ulong>(enumType, Unsafe.As<byte, ulong>(ref rawData), destination, out charsWritten), 1708CorElementType.ELEMENT_TYPE_R4 => TryFormatPrimitiveDefault<float, float>(enumType, Unsafe.As<byte, float>(ref rawData), destination, out charsWritten), 1709CorElementType.ELEMENT_TYPE_R8 => TryFormatPrimitiveDefault<double, double>(enumType, Unsafe.As<byte, double>(ref rawData), destination, out charsWritten), 1710CorElementType.ELEMENT_TYPE_I => TryFormatPrimitiveDefault<nint, nuint>(enumType, Unsafe.As<byte, nint>(ref rawData), destination, out charsWritten), 1711CorElementType.ELEMENT_TYPE_U => TryFormatPrimitiveDefault<nuint, nuint>(enumType, Unsafe.As<byte, nuint>(ref rawData), destination, out charsWritten), 1712CorElementType.ELEMENT_TYPE_CHAR => TryFormatPrimitiveDefault<char, char>(enumType, Unsafe.As<byte, char>(ref rawData), destination, out charsWritten), 1723CorElementType.ELEMENT_TYPE_I2 => TryFormatPrimitiveNonDefault<short, ushort>(enumType, Unsafe.As<byte, short>(ref rawData), destination, out charsWritten, format), 1724CorElementType.ELEMENT_TYPE_U2 => TryFormatPrimitiveNonDefault<ushort, ushort>(enumType, Unsafe.As<byte, ushort>(ref rawData), destination, out charsWritten, format), 1725CorElementType.ELEMENT_TYPE_I4 => TryFormatPrimitiveNonDefault<int, uint>(enumType, Unsafe.As<byte, int>(ref rawData), destination, out charsWritten, format), 1726CorElementType.ELEMENT_TYPE_U4 => TryFormatPrimitiveNonDefault<uint, uint>(enumType, Unsafe.As<byte, uint>(ref rawData), destination, out charsWritten, format), 1727CorElementType.ELEMENT_TYPE_I8 => TryFormatPrimitiveNonDefault<long, ulong>(enumType, Unsafe.As<byte, long>(ref rawData), destination, out charsWritten, format), 1728CorElementType.ELEMENT_TYPE_U8 => TryFormatPrimitiveNonDefault<ulong, ulong>(enumType, Unsafe.As<byte, ulong>(ref rawData), destination, out charsWritten, format), 1730CorElementType.ELEMENT_TYPE_R4 => TryFormatPrimitiveNonDefault<float, float>(enumType, Unsafe.As<byte, float>(ref rawData), destination, out charsWritten, format), 1731CorElementType.ELEMENT_TYPE_R8 => TryFormatPrimitiveNonDefault<double, double>(enumType, Unsafe.As<byte, double>(ref rawData), destination, out charsWritten, format), 1732CorElementType.ELEMENT_TYPE_I => TryFormatPrimitiveNonDefault<nint, nuint>(enumType, Unsafe.As<byte, nint>(ref rawData), destination, out charsWritten, format), 1733CorElementType.ELEMENT_TYPE_U => TryFormatPrimitiveNonDefault<nuint, nuint>(enumType, Unsafe.As<byte, nuint>(ref rawData), destination, out charsWritten, format), 1734CorElementType.ELEMENT_TYPE_CHAR => TryFormatPrimitiveNonDefault<char, char>(enumType, Unsafe.As<byte, char>(ref rawData), destination, out charsWritten, format), 1868if (GetNameInlined(enumInfo, Unsafe.BitCast<TUnderlying, TStorage>(value)) is string enumName) 1883if (TryFormatFlagNames(enumInfo, Unsafe.BitCast<TUnderlying, TStorage>(value), destination, out charsWritten, ref destinationIsTooSmall) || destinationIsTooSmall) 1912return TryFormatNumberAsHex<TStorage>(ref Unsafe.As<TUnderlying, byte>(ref value), destination, out charsWritten); 1916if (TryFormatFlagNames(GetEnumInfo<TStorage>(enumType), Unsafe.BitCast<TUnderlying, TStorage>(value), destination, out charsWritten, ref destinationIsTooSmall) ||
src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (27)
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) */); 242return Unsafe.ReadUnaligned<double>(ref refToValue); 246ulong temp = Unsafe.ReadUnaligned<ulong>(ref refToValue); 260ref short rsStart = ref Unsafe.As<byte, short>(ref MemoryMarshal.GetReference(UppercaseValues)); 261ref short rsDelta = ref Unsafe.Add(ref rsStart, (nint)offset); 279ref ushort rsStart = ref Unsafe.As<byte, ushort>(ref MemoryMarshal.GetReference(UppercaseValues)); 280ref ushort rsDelta = ref Unsafe.Add(ref rsStart, (nint)offset); 295ref short rsStart = ref Unsafe.As<byte, short>(ref MemoryMarshal.GetReference(LowercaseValues)); 296ref short rsDelta = ref Unsafe.Add(ref rsStart, (nint)offset); 314ref ushort rsStart = ref Unsafe.As<byte, ushort>(ref MemoryMarshal.GetReference(LowercaseValues)); 315ref ushort rsDelta = ref Unsafe.Add(ref rsStart, (nint)offset); 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)); 465index = Unsafe.ReadUnaligned<ushort>(ref level2Ref); 469index = BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned<ushort>(ref level2Ref)); 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)); 502index = Unsafe.ReadUnaligned<ushort>(ref level2Ref); 506index = BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned<ushort>(ref level2Ref)); 512return Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericGraphemeLevel3Index), (index << 4) + (codePoint & 0x0F));
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.cs (2)
366Debug.Assert(!Unsafe.IsNullRef(ref MemoryMarshal.GetReference(span1))); 367Debug.Assert(!Unsafe.IsNullRef(ref MemoryMarshal.GetReference(span2)));
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (1)
1115bool success = Unsafe.AreSame(ref MemoryMarshal.GetReference(destination), ref MemoryMarshal.GetReference(vlb.AsSpan()));
src\libraries\System.Private.CoreLib\src\System\Globalization\InvariantModeCasing.cs (5)
172char charB = Unsafe.Add(ref source, 1); 201charA = ref Unsafe.Add(ref charA, codePointLengthA); 202charB = ref Unsafe.Add(ref charB, codePointLengthB); 213charA = ref Unsafe.Add(ref charA, codePointLengthA); 214charB = ref Unsafe.Add(ref charB, codePointLengthB);
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (33)
33charA = ref Unsafe.Add(ref charA, 1); 34charB = ref Unsafe.Add(ref charB, 1); 96vec1 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charA), i); 97vec2 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charB), i); 123vec1 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charA), i); 124vec2 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charB), i); 155ref Unsafe.Add(ref charA, i), (int)(lengthU - i), 156ref Unsafe.Add(ref charB, i), (int)(lengthU - i)) == 0; 187valueAu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); 188valueBu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset))); 222valueAu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); 223valueBu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset))); 250valueAu32 = Unsafe.AddByteOffset(ref charA, byteOffset); 251valueBu32 = Unsafe.AddByteOffset(ref charB, byteOffset); 294return CompareStringIgnoreCase(ref Unsafe.AddByteOffset(ref charA, byteOffset), length, ref Unsafe.AddByteOffset(ref charB, byteOffset), length) == 0; 377valueCharU = Unsafe.Add(ref valueRef, valueTailLength); 400? PackedSpanHelpers.IndexOfAnyIgnoreCase(ref Unsafe.Add(ref searchSpace, offset), valueCharL, searchSpaceMinusValueTailLength) 401: SpanHelpers.IndexOfAnyChar(ref Unsafe.Add(ref searchSpace, offset), valueCharU, valueCharL, searchSpaceMinusValueTailLength) : 402SpanHelpers.IndexOfChar(ref Unsafe.Add(ref searchSpace, offset), valueChar, searchSpaceMinusValueTailLength); 418ref Unsafe.Add(ref searchSpace, (nuint)(offset + 1)), 419ref Unsafe.Add(ref valueRef, 1), valueTailLength)) 445char tmp = Unsafe.Add(ref valueRef, ch1ch2Distance - 1); 507if (EqualsIgnoreCase(ref Unsafe.Add(ref searchSpace, offset + charPos), ref valueRef, value.Length)) 573if (EqualsIgnoreCase(ref Unsafe.Add(ref searchSpace, offset + charPos), ref valueRef, value.Length))
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.Utf8.cs (56)
38charA = ref Unsafe.Add(ref charA, 1); 39charB = ref Unsafe.Add(ref charB, 1); 145return EqualsIgnoreCaseUtf8_Scalar(ref Unsafe.Add(ref charA, i), (int)(lengthU - i), ref Unsafe.Add(ref charB, i), (int)(lengthU - i)); 156ref Unsafe.Add(ref charA, i), lengthA - (int)i, 157ref Unsafe.Add(ref charB, i), lengthB - (int)i 186valueAu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.AddByteOffset(ref charA, byteOffset)); 187valueBu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.AddByteOffset(ref charB, byteOffset)); 225valueAu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref charA, byteOffset)); 226valueBu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref charB, byteOffset)); 260valueAu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref charA, byteOffset)); 261valueBu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref charB, byteOffset)); 265valueAu32 |= (uint)(Unsafe.AddByteOffset(ref charA, byteOffset) << 16); 266valueBu32 |= (uint)(Unsafe.AddByteOffset(ref charB, byteOffset) << 16); 270valueAu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref charA, byteOffset)); 271valueBu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref charB, byteOffset)); 277valueAu32 = Unsafe.AddByteOffset(ref charA, byteOffset); 278valueBu32 = Unsafe.AddByteOffset(ref charB, byteOffset); 326return EqualsStringIgnoreCaseUtf8(ref Unsafe.AddByteOffset(ref charA, byteOffset), lengthA - range, ref Unsafe.AddByteOffset(ref charB, byteOffset), lengthB - range); 348source = ref Unsafe.Add(ref source, 1); 349prefix = ref Unsafe.Add(ref prefix, 1); 455return StartsWithIgnoreCaseUtf8_Scalar(ref Unsafe.Add(ref source, i), (int)(lengthU - i), ref Unsafe.Add(ref prefix, i), (int)(lengthU - i)); 466ref Unsafe.Add(ref source, i), sourceLength - (int)i, 467ref Unsafe.Add(ref prefix, i), prefixLength - (int)i 496valueAu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.AddByteOffset(ref source, byteOffset)); 497valueBu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.AddByteOffset(ref prefix, byteOffset)); 535valueAu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref source, byteOffset)); 536valueBu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref prefix, byteOffset)); 570valueAu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref source, byteOffset)); 571valueBu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref prefix, byteOffset)); 575valueAu32 |= (uint)(Unsafe.AddByteOffset(ref source, byteOffset) << 16); 576valueBu32 |= (uint)(Unsafe.AddByteOffset(ref prefix, byteOffset) << 16); 580valueAu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref source, byteOffset)); 581valueBu32 = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref prefix, byteOffset)); 587valueAu32 = Unsafe.AddByteOffset(ref source, byteOffset); 588valueBu32 = Unsafe.AddByteOffset(ref prefix, byteOffset); 640return StartsWithStringIgnoreCaseUtf8(ref Unsafe.AddByteOffset(ref source, byteOffset), sourceLength - range, ref Unsafe.AddByteOffset(ref prefix, byteOffset), prefixLength - range);
src\libraries\System.Private.CoreLib\src\System\Globalization\OrdinalCasing.Icu.cs (11)
204if (!char.IsHighSurrogate(a) || index >= lengthA - 1 || !char.IsLowSurrogate(lowSurrogateA = Unsafe.Add(ref charA, 1))) 206if (!char.IsHighSurrogate(b) || index >= lengthB - 1 || !char.IsLowSurrogate(Unsafe.Add(ref charB, 1))) 215charA = ref Unsafe.Add(ref charA, 1); 216charB = ref Unsafe.Add(ref charB, 1); 226charA = ref Unsafe.Add(ref charA, 1); 227charB = ref Unsafe.Add(ref charB, 1); 247if (!char.IsHighSurrogate(b) || index >= lengthB - 1 || !char.IsLowSurrogate(lowSurrogateB = Unsafe.Add(ref charB, 1))) 266charA = ref Unsafe.Add(ref charA, 2); 267charB = ref Unsafe.Add(ref charB, 2); 277charA = ref Unsafe.Add(ref charA, 2); 278charB = ref Unsafe.Add(ref charB, 2);
src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.cs (1)
291uint tempValue = Unsafe.ReadUnaligned<uint>(pSource + currIdx);
src\libraries\System.Private.CoreLib\src\System\Guid.cs (20)
235return Unsafe.As<GuidResult, Guid>(ref Unsafe.AsRef(in this)); 717Unsafe.Add(ref result._d, i) = (byte)byteVal; 924ref int r = ref Unsafe.AsRef(in _a); 925return r ^ Unsafe.Add(ref r, 1) ^ Unsafe.Add(ref r, 2) ^ Unsafe.Add(ref r, 3); 939return Vector128.LoadUnsafe(ref Unsafe.As<Guid, byte>(ref Unsafe.AsRef(in left))) == Vector128.LoadUnsafe(ref Unsafe.As<Guid, byte>(ref Unsafe.AsRef(in right))); 942ref int rA = ref Unsafe.AsRef(in left._a); 943ref int rB = ref Unsafe.AsRef(in right._a); 948&& Unsafe.Add(ref rA, 1) == Unsafe.Add(ref rB, 1) 949&& Unsafe.Add(ref rA, 2) == Unsafe.Add(ref rB, 2) 950&& Unsafe.Add(ref rA, 3) == Unsafe.Add(ref rB, 3); 1432Vector128<byte> srcVec = Unsafe.As<Guid, Vector128<byte>>(ref value);
src\libraries\System.Private.CoreLib\src\System\Guid.Unix.cs (2)
35Unsafe.AsRef(in g._c) = (short)((g._c & ~VersionMask) | RandomGuidVersion); 37Unsafe.AsRef(in g._d) = (byte)((g._d & ~ClockSeqHiAndReservedMask) | ClockSeqHiAndReservedValue);
src\libraries\System.Private.CoreLib\src\System\Half.cs (7)
749uint realMask = (uint)(Unsafe.BitCast<bool, sbyte>(float.IsNaN(value)) - 1); 1078uint subnormalMask = (uint)-Unsafe.BitCast<bool, byte>(offsetExponent == 0u); 1080int infinityOrNaNMask = Unsafe.BitCast<bool, byte>(offsetExponent == HalfExponentMask); 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 (27)
321ref byte end = ref Unsafe.Add(ref pos, value.Length); 340Debug.Assert(Unsafe.ByteOffset(ref pos, ref end) >= sizeof(int)); 341Add(Unsafe.ReadUnaligned<int>(ref pos)); 342pos = ref Unsafe.Add(ref pos, sizeof(int)); 345Debug.Assert(Unsafe.ByteOffset(ref pos, ref end) >= sizeof(int)); 346Add(Unsafe.ReadUnaligned<int>(ref pos)); 347pos = ref Unsafe.Add(ref pos, sizeof(int)); 350Debug.Assert(Unsafe.ByteOffset(ref pos, ref end) >= sizeof(int)); 351Add(Unsafe.ReadUnaligned<int>(ref pos)); 352pos = ref Unsafe.Add(ref pos, sizeof(int)); 359ref byte blockEnd = ref Unsafe.Subtract(ref end, Unsafe.ByteOffset(ref pos, ref end) % (sizeof(int) * 4)); 360while (Unsafe.IsAddressLessThan(ref pos, ref blockEnd)) 362Debug.Assert(Unsafe.ByteOffset(ref pos, ref blockEnd) >= (sizeof(int) * 4)); 363uint v1 = Unsafe.ReadUnaligned<uint>(ref pos); 365uint v2 = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref pos, sizeof(int) * 1)); 367uint v3 = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref pos, sizeof(int) * 2)); 369uint v4 = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref pos, sizeof(int) * 3)); 373pos = ref Unsafe.Add(ref pos, sizeof(int) * 4); 378while (Unsafe.ByteOffset(ref pos, ref end) >= sizeof(int)) 380Add(Unsafe.ReadUnaligned<int>(ref pos)); 381pos = ref Unsafe.Add(ref pos, sizeof(int)); 385while (Unsafe.IsAddressLessThan(ref pos, ref end)) 388pos = ref Unsafe.Add(ref pos, 1);
src\libraries\System.Private.CoreLib\src\System\Int128.cs (11)
804sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - Size); 807result = Unsafe.ReadUnaligned<Int128>(ref sourceRef); 823result |= Unsafe.Add(ref sourceRef, i); 887result = Unsafe.ReadUnaligned<Int128>(ref sourceRef); 905result |= Unsafe.Add(ref sourceRef, i); 956Unsafe.WriteUnaligned(ref address, upper); 957Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref address, sizeof(ulong)), lower); 985Unsafe.WriteUnaligned(ref address, lower); 986Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref address, sizeof(ulong)), upper);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (5)
348sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(short)); 351result = Unsafe.ReadUnaligned<short>(ref sourceRef); 424result = Unsafe.ReadUnaligned<short>(ref sourceRef); 471Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 489Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (7)
362sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(int)); 365result = Unsafe.ReadUnaligned<int>(ref sourceRef); 381result |= Unsafe.Add(ref sourceRef, i); 445result = Unsafe.ReadUnaligned<int>(ref sourceRef); 463result |= Unsafe.Add(ref sourceRef, i); 504Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 522Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\Int64.cs (7)
359sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(long)); 362result = Unsafe.ReadUnaligned<long>(ref sourceRef); 378result |= Unsafe.Add(ref sourceRef, i); 442result = Unsafe.ReadUnaligned<long>(ref sourceRef); 460result |= Unsafe.Add(ref sourceRef, i); 501Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 519Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (25)
227Unsafe.SkipInit(out result); 228return nint_t.TryParse(s, out Unsafe.As<nint, nint_t>(ref result)); 234Unsafe.SkipInit(out result); 235return nint_t.TryParse(s, provider, out Unsafe.As<nint, nint_t>(ref result)); 240Unsafe.SkipInit(out result); 241return nint_t.TryParse(s, style, provider, out Unsafe.As<nint, nint_t>(ref result)); 246Unsafe.SkipInit(out result); 247return nint_t.TryParse(s, out Unsafe.As<nint, nint_t>(ref result)); 256Unsafe.SkipInit(out result); 257return nint_t.TryParse(utf8Text, out Unsafe.As<nint, nint_t>(ref result)); 267Unsafe.SkipInit(out result); 268return nint_t.TryParse(s, provider, out Unsafe.As<nint, nint_t>(ref result)); 273Unsafe.SkipInit(out result); 274return nint_t.TryParse(s, style, provider, out Unsafe.As<nint, nint_t>(ref result)); 370sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(nint_t)); 373result = Unsafe.ReadUnaligned<nint>(ref sourceRef); 389result |= Unsafe.Add(ref sourceRef, i); 453result = Unsafe.ReadUnaligned<nint>(ref sourceRef); 471result |= Unsafe.Add(ref sourceRef, i); 517Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 540Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 1414Unsafe.SkipInit(out result); 1415return nint_t.TryParse(utf8Text, style, provider, out Unsafe.As<nint, nint_t>(ref result)); 1424Unsafe.SkipInit(out result); 1425return nint_t.TryParse(utf8Text, provider, out Unsafe.As<nint, nint_t>(ref result));
src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (2)
360MemoryStream mStream = Unsafe.As<MemoryStream>(_stream); 464return Unsafe.As<MemoryStream>(_stream).InternalReadSpan(buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryAccessor.cs (14)
152result = Unsafe.ReadUnaligned<short>(pointer + _offset + position); 177result = Unsafe.ReadUnaligned<int>(pointer + _offset + position); 202result = Unsafe.ReadUnaligned<long>(pointer + _offset + position); 232lo = Unsafe.ReadUnaligned<int>(pointer); 233mid = Unsafe.ReadUnaligned<int>(pointer + 4); 234hi = Unsafe.ReadUnaligned<int>(pointer + 8); 235flags = Unsafe.ReadUnaligned<int>(pointer + 12); 401Unsafe.WriteUnaligned(pointer + _offset + position, value); 424Unsafe.WriteUnaligned(pointer + _offset + position, value); 447Unsafe.WriteUnaligned(pointer + _offset + position, value); 475Unsafe.WriteUnaligned(pointer, bits[0]); 476Unsafe.WriteUnaligned(pointer + 4, bits[1]); 477Unsafe.WriteUnaligned(pointer + 8, bits[2]); 478Unsafe.WriteUnaligned(pointer + 12, bits[3]);
src\libraries\System.Private.CoreLib\src\System\Marvin.cs (11)
58p0 += Unsafe.ReadUnaligned<uint>(ref data); 59uint nextUInt32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, 4)); 74data = ref Unsafe.AddByteOffset(ref data, 8); 95p0 += Unsafe.ReadUnaligned<uint>(ref data); 110uint partialResult = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref Unsafe.AddByteOffset(ref data, (nuint)count & 7), -4)); 176partialResult = Unsafe.AddByteOffset(ref data, (nuint)count & 2); 202partialResult |= (uint)Unsafe.ReadUnaligned<ushort>(ref data); 206partialResult |= (uint)Unsafe.ReadUnaligned<ushort>(ref data);
src\libraries\System.Private.CoreLib\src\System\Marvin.OrdinalIgnoreCase.cs (6)
28tempValue = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref data, byteOffset))); 45tempValue = Unsafe.AddByteOffset(ref data, byteOffset); 78return ComputeHash32OrdinalIgnoreCaseSlow(ref Unsafe.AddByteOffset(ref data, byteOffset), (int)ucount, p0, p1); 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 (18)
190Unsafe.As<Memory<T>, ReadOnlyMemory<T>>(ref memory); 278ref T refToReturn = ref Unsafe.NullRef<T>(); 290refToReturn = ref Unsafe.As<char, T>(ref Unsafe.As<string>(tmpObject).GetRawStringData()); 291lengthOfUnderlyingSpan = Unsafe.As<string>(tmpObject).Length; 307refToReturn = ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject)); 308lengthOfUnderlyingSpan = Unsafe.As<T[]>(tmpObject).Length; 319Span<T> memoryManagerSpan = Unsafe.As<MemoryManager<T>>(tmpObject).GetSpan(); 346refToReturn = ref Unsafe.Add(ref refToReturn, (IntPtr)(void*)desiredStartIndex); 403ref char stringData = ref Unsafe.Add(ref s.GetRawStringData(), _index); 404return new MemoryHandle(Unsafe.AsPointer(ref stringData), handle); 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); 429return Unsafe.As<MemoryManager<T>>(tmpObject).Pin(_index);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (390)
40return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), array.Length - start); 64return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)actualIndex /* force zero-extension */), array.Length - actualIndex); 88return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), length); 127return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)start /* force zero-extension */), text.Length - start); 153return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)actualIndex /* force zero-extension */), text.Length - actualIndex); 179return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)start /* force zero-extension */), length); 211return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)start /* force zero-extension */), length); 325ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 326Unsafe.BitCast<T, byte>(value), 332ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 333Unsafe.BitCast<T, short>(value), 339ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 340Unsafe.BitCast<T, int>(value), 346ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 347Unsafe.BitCast<T, long>(value), 369ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 370Unsafe.BitCast<T, byte>(value), 376ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 377Unsafe.BitCast<T, short>(value), 383ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 384Unsafe.BitCast<T, int>(value), 390ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 391Unsafe.BitCast<T, long>(value), 625ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 626Unsafe.BitCast<T, byte>(value), 631ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 632Unsafe.BitCast<T, short>(value), 637ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 638Unsafe.BitCast<T, int>(value), 643ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 644Unsafe.BitCast<T, long>(value), 663ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 665ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 670ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 672ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 692ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 693Unsafe.BitCast<T, byte>(value), 699ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 700Unsafe.BitCast<T, short>(value), 706ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 707Unsafe.BitCast<T, int>(value), 713ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 714Unsafe.BitCast<T, long>(value), 735ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 737ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 743ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 745ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 828ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 829Unsafe.BitCast<T, byte>(value), 835ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 836Unsafe.BitCast<T, short>(value), 842ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 843Unsafe.BitCast<T, int>(value), 849ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 850Unsafe.BitCast<T, long>(value), 875ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 876Unsafe.BitCast<T, byte>(value0), 877Unsafe.BitCast<T, byte>(value1), 883ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 884Unsafe.BitCast<T, short>(value0), 885Unsafe.BitCast<T, short>(value1), 911ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 912Unsafe.BitCast<T, byte>(value0), 913Unsafe.BitCast<T, byte>(value1), 914Unsafe.BitCast<T, byte>(value2), 920ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 921Unsafe.BitCast<T, short>(value0), 922Unsafe.BitCast<T, short>(value1), 923Unsafe.BitCast<T, short>(value2), 939ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 940Unsafe.BitCast<T, byte>(value0), 941Unsafe.BitCast<T, byte>(value1), 942Unsafe.BitCast<T, byte>(value2), 943Unsafe.BitCast<T, byte>(value3), 949ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 950Unsafe.BitCast<T, short>(value0), 951Unsafe.BitCast<T, short>(value1), 952Unsafe.BitCast<T, short>(value2), 953Unsafe.BitCast<T, short>(value3), 996ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 999ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1001Unsafe.Add(ref valuesRef, 1), 1002Unsafe.Add(ref valuesRef, 2), 1003Unsafe.Add(ref valuesRef, 3), 1004Unsafe.Add(ref valuesRef, 4), 1009ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 1012ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1014Unsafe.Add(ref valuesRef, 1), 1015Unsafe.Add(ref valuesRef, 2), 1016Unsafe.Add(ref valuesRef, 3), 1017Unsafe.Add(ref valuesRef, 4), 1025ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1027ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)), 1137ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1138Unsafe.BitCast<T, byte>(value), 1144ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1145Unsafe.BitCast<T, short>(value), 1151ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1152Unsafe.BitCast<T, int>(value), 1158ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1159Unsafe.BitCast<T, long>(value), 1184ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1185Unsafe.BitCast<T, byte>(value0), 1186Unsafe.BitCast<T, byte>(value1), 1192ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1193Unsafe.BitCast<T, short>(value0), 1194Unsafe.BitCast<T, short>(value1), 1220ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1221Unsafe.BitCast<T, byte>(value0), 1222Unsafe.BitCast<T, byte>(value1), 1223Unsafe.BitCast<T, byte>(value2), 1229ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1230Unsafe.BitCast<T, short>(value0), 1231Unsafe.BitCast<T, short>(value1), 1232Unsafe.BitCast<T, short>(value2), 1248ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1249Unsafe.BitCast<T, byte>(value0), 1250Unsafe.BitCast<T, byte>(value1), 1251Unsafe.BitCast<T, byte>(value2), 1252Unsafe.BitCast<T, byte>(value3), 1258ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1259Unsafe.BitCast<T, short>(value0), 1260Unsafe.BitCast<T, short>(value1), 1261Unsafe.BitCast<T, short>(value2), 1262Unsafe.BitCast<T, short>(value3), 1306ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 1309ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1311Unsafe.Add(ref valuesRef, 1), 1312Unsafe.Add(ref valuesRef, 2), 1313Unsafe.Add(ref valuesRef, 3), 1314Unsafe.Add(ref valuesRef, 4), 1319ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 1322ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1324Unsafe.Add(ref valuesRef, 1), 1325Unsafe.Add(ref valuesRef, 2), 1326Unsafe.Add(ref valuesRef, 3), 1327Unsafe.Add(ref valuesRef, 4), 1335ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1337ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)), 1401ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1402Unsafe.BitCast<T, byte>(lowInclusive), 1403Unsafe.BitCast<T, byte>(highInclusive), 1410ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1411Unsafe.BitCast<T, ushort>(lowInclusive), 1412Unsafe.BitCast<T, ushort>(highInclusive), 1419ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1420Unsafe.BitCast<T, uint>(lowInclusive), 1421Unsafe.BitCast<T, uint>(highInclusive), 1428ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1429Unsafe.BitCast<T, ulong>(lowInclusive), 1430Unsafe.BitCast<T, ulong>(highInclusive), 1467ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1468Unsafe.BitCast<T, byte>(lowInclusive), 1469Unsafe.BitCast<T, byte>(highInclusive), 1476ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1477Unsafe.BitCast<T, ushort>(lowInclusive), 1478Unsafe.BitCast<T, ushort>(highInclusive), 1485ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1486Unsafe.BitCast<T, uint>(lowInclusive), 1487Unsafe.BitCast<T, uint>(highInclusive), 1494ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1495Unsafe.BitCast<T, ulong>(lowInclusive), 1496Unsafe.BitCast<T, ulong>(highInclusive), 1533ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1534Unsafe.BitCast<T, byte>(lowInclusive), 1535Unsafe.BitCast<T, byte>(highInclusive), 1542ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1543Unsafe.BitCast<T, ushort>(lowInclusive), 1544Unsafe.BitCast<T, ushort>(highInclusive), 1551ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1552Unsafe.BitCast<T, uint>(lowInclusive), 1553Unsafe.BitCast<T, uint>(highInclusive), 1560ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1561Unsafe.BitCast<T, ulong>(lowInclusive), 1562Unsafe.BitCast<T, ulong>(highInclusive), 1599ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1600Unsafe.BitCast<T, byte>(lowInclusive), 1601Unsafe.BitCast<T, byte>(highInclusive), 1608ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1609Unsafe.BitCast<T, ushort>(lowInclusive), 1610Unsafe.BitCast<T, ushort>(highInclusive), 1617ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1618Unsafe.BitCast<T, uint>(lowInclusive), 1619Unsafe.BitCast<T, uint>(highInclusive), 1626ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1627Unsafe.BitCast<T, ulong>(lowInclusive), 1628Unsafe.BitCast<T, ulong>(highInclusive), 1658ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1659ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 1677ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1679ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 1684ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1686ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)), 1704ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1705Unsafe.BitCast<T, byte>(value), 1710ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1711Unsafe.BitCast<T, short>(value), 1716ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1717Unsafe.BitCast<T, int>(value), 1722ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1723Unsafe.BitCast<T, long>(value), 1742ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1744ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 1749ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1751ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 1771ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1772Unsafe.BitCast<T, byte>(value), 1778ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1779Unsafe.BitCast<T, short>(value), 1785ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1786Unsafe.BitCast<T, int>(value), 1792ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1793Unsafe.BitCast<T, long>(value), 1814ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1816ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 1822ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1824ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 1846ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1847Unsafe.BitCast<T, byte>(value0), 1848Unsafe.BitCast<T, byte>(value1), 1854ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1855Unsafe.BitCast<T, short>(value0), 1856Unsafe.BitCast<T, short>(value1), 1879ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1880Unsafe.BitCast<T, byte>(value0), 1881Unsafe.BitCast<T, byte>(value1), 1882Unsafe.BitCast<T, byte>(value2), 1888ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1889Unsafe.BitCast<T, short>(value0), 1890Unsafe.BitCast<T, short>(value1), 1891Unsafe.BitCast<T, short>(value2), 1940ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1941Unsafe.BitCast<T, byte>(value0), 1942Unsafe.BitCast<T, byte>(value1), 1948ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1949Unsafe.BitCast<T, short>(value0), 1950Unsafe.BitCast<T, short>(value1), 1973ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1974Unsafe.BitCast<T, byte>(value0), 1975Unsafe.BitCast<T, byte>(value1), 1976Unsafe.BitCast<T, byte>(value2), 1982ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1983Unsafe.BitCast<T, short>(value0), 1984Unsafe.BitCast<T, short>(value1), 1985Unsafe.BitCast<T, short>(value2), 2005ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 2006ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 2019Unsafe.Add(ref valueRef, 1), 2026Unsafe.Add(ref valueRef, 1), 2027Unsafe.Add(ref valueRef, 2), 2034Unsafe.Add(ref valueRef, 1), 2035Unsafe.Add(ref valueRef, 2), 2036Unsafe.Add(ref valueRef, 3), 2043Unsafe.Add(ref valueRef, 1), 2044Unsafe.Add(ref valueRef, 2), 2045Unsafe.Add(ref valueRef, 3), 2046Unsafe.Add(ref valueRef, 4), 2053ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)); 2054ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 2067Unsafe.Add(ref valueRef, 1), 2074Unsafe.Add(ref valueRef, 1), 2075Unsafe.Add(ref valueRef, 2), 2082Unsafe.Add(ref valueRef, 1), 2083Unsafe.Add(ref valueRef, 2), 2084Unsafe.Add(ref valueRef, 3), 2091Unsafe.Add(ref valueRef, 1), 2092Unsafe.Add(ref valueRef, 2), 2093Unsafe.Add(ref valueRef, 3), 2094Unsafe.Add(ref valueRef, 4), 2098return ProbabilisticMap.IndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length); 2152ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2153Unsafe.BitCast<T, byte>(value0), 2154Unsafe.BitCast<T, byte>(value1), 2160ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2161Unsafe.BitCast<T, short>(value0), 2162Unsafe.BitCast<T, short>(value1), 2185ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2186Unsafe.BitCast<T, byte>(value0), 2187Unsafe.BitCast<T, byte>(value1), 2188Unsafe.BitCast<T, byte>(value2), 2194ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2195Unsafe.BitCast<T, short>(value0), 2196Unsafe.BitCast<T, short>(value1), 2197Unsafe.BitCast<T, short>(value2), 2237ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2238Unsafe.BitCast<T, byte>(value0), 2239Unsafe.BitCast<T, byte>(value1), 2245ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2246Unsafe.BitCast<T, short>(value0), 2247Unsafe.BitCast<T, short>(value1), 2270ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2271Unsafe.BitCast<T, byte>(value0), 2272Unsafe.BitCast<T, byte>(value1), 2273Unsafe.BitCast<T, byte>(value2), 2279ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2280Unsafe.BitCast<T, short>(value0), 2281Unsafe.BitCast<T, short>(value1), 2282Unsafe.BitCast<T, short>(value2), 2302ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 2303ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 2316Unsafe.Add(ref valueRef, 1), 2323Unsafe.Add(ref valueRef, 1), 2324Unsafe.Add(ref valueRef, 2), 2331Unsafe.Add(ref valueRef, 1), 2332Unsafe.Add(ref valueRef, 2), 2333Unsafe.Add(ref valueRef, 3), 2340Unsafe.Add(ref valueRef, 1), 2341Unsafe.Add(ref valueRef, 2), 2342Unsafe.Add(ref valueRef, 3), 2343Unsafe.Add(ref valueRef, 4), 2350ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)); 2351ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 2364Unsafe.Add(ref valueRef, 1), 2371Unsafe.Add(ref valueRef, 1), 2372Unsafe.Add(ref valueRef, 2), 2379Unsafe.Add(ref valueRef, 1), 2380Unsafe.Add(ref valueRef, 2), 2381Unsafe.Add(ref valueRef, 3), 2388Unsafe.Add(ref valueRef, 1), 2389Unsafe.Add(ref valueRef, 2), 2390Unsafe.Add(ref valueRef, 3), 2391Unsafe.Add(ref valueRef, 4), 2395return ProbabilisticMap.LastIndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length); 2433ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2434ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 2474ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2475ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 2517ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2519ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 2524ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 2526ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)), 2544ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2545ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2564ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2565ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2585ref Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */)), 2586ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2592ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */), 2610ref Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */)), 2611ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2617ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */), 3041nint byteOffset = Unsafe.ByteOffset( 3060nint byteOffset = Unsafe.ByteOffset( 3381ref byte src = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 3385Unsafe.BitCast<T, byte>(oldValue), 3386Unsafe.BitCast<T, byte>(newValue), 3393ref ushort src = ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)); 3397Unsafe.BitCast<T, ushort>(oldValue), 3398Unsafe.BitCast<T, ushort>(newValue), 3404ref int src = ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)); 3408Unsafe.BitCast<T, int>(oldValue), 3409Unsafe.BitCast<T, int>(newValue), 3415ref long src = ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)); 3419Unsafe.BitCast<T, long>(oldValue), 3420Unsafe.BitCast<T, long>(newValue), 3457nint byteOffset = Unsafe.ByteOffset(ref src, ref dst); 3470ref Unsafe.As<T, byte>(ref src), 3471ref Unsafe.As<T, byte>(ref dst), 3472Unsafe.BitCast<T, byte>(oldValue), 3473Unsafe.BitCast<T, byte>(newValue), 3481ref Unsafe.As<T, ushort>(ref src), 3482ref Unsafe.As<T, ushort>(ref dst), 3483Unsafe.BitCast<T, ushort>(oldValue), 3484Unsafe.BitCast<T, ushort>(newValue), 3491ref Unsafe.As<T, int>(ref src), 3492ref Unsafe.As<T, int>(ref dst), 3493Unsafe.BitCast<T, int>(oldValue), 3494Unsafe.BitCast<T, int>(newValue), 3501ref Unsafe.As<T, long>(ref src), 3502ref Unsafe.As<T, long>(ref dst), 3503Unsafe.BitCast<T, long>(oldValue), 3504Unsafe.BitCast<T, long>(newValue), 3542ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3543ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 3975if (Unsafe.SizeOf<T>() == sizeof(byte)) 3978ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3979Unsafe.BitCast<T, byte>(value), 3982else if (Unsafe.SizeOf<T>() == sizeof(short)) 3985ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 3986Unsafe.BitCast<T, short>(value), 3989else if (Unsafe.SizeOf<T>() == sizeof(int)) 3992ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 3993Unsafe.BitCast<T, int>(value), 3996else if (Unsafe.SizeOf<T>() == sizeof(long)) 3999ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 4000Unsafe.BitCast<T, long>(value),
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.cs (1)
325ref Unsafe.Add(ref MemoryMarshal.GetReference(span), span.Length - value.Length),
src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (1)
1329(byte*)Unsafe.AsPointer(ref _blocks[0]), // This is safe to do since we are a ref struct
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (6)
1812Unsafe.CopyBlockUnaligned( 1814ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(typeof(TChar) == typeof(char) ? TwoDigitsCharsAsBytes : TwoDigitsBytes), (uint)sizeof(TChar) * 2 * value), 1832Unsafe.CopyBlockUnaligned( 1834ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * value), 1837Unsafe.CopyBlockUnaligned( 1839ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * remainder),
src\libraries\System.Private.CoreLib\src\System\Number.NumberToFloatingPointBits.cs (1)
954ulong val = Unsafe.ReadUnaligned<ulong>(chars);
src\libraries\System.Private.CoreLib\src\System\Numerics\BitOperations.cs (9)
393return Unsafe.AddByteOffset( 576return Unsafe.AddByteOffset( 876crc = Unsafe.Add(ref lookupTable, (nint)(byte)(crc ^ data)) ^ (crc >> 8); 885crc = Unsafe.Add(ref lookupTable, (nint)(byte)(crc ^ (byte)data)) ^ (crc >> 8); 887crc = Unsafe.Add(ref lookupTable, (nint)(byte)(crc ^ data)) ^ (crc >> 8); 901crc = Unsafe.Add(ref lookupTable, (nint)(byte)(crc ^ (byte)data)) ^ (crc >> 8); 903crc = Unsafe.Add(ref lookupTable, (nint)(byte)(crc ^ (byte)data)) ^ (crc >> 8); 905crc = Unsafe.Add(ref lookupTable, (nint)(byte)(crc ^ (byte)data)) ^ (crc >> 8); 907crc = Unsafe.Add(ref lookupTable, (nint)(byte)(crc ^ data)) ^ (crc >> 8);
src\libraries\System.Private.CoreLib\src\System\Numerics\Matrix3x2.cs (2)
55Unsafe.SkipInit(out this); 265Unsafe.SkipInit(out result);
src\libraries\System.Private.CoreLib\src\System\Numerics\Matrix3x2.Impl.cs (7)
23internal ref Impl AsImpl() => ref Unsafe.As<Matrix3x2, Impl>(ref this); 27internal readonly ref readonly Impl AsROImpl() => ref Unsafe.As<Matrix3x2, Impl>(ref Unsafe.AsRef(in this)); 33public ref Matrix3x2 AsM3x2() => ref Unsafe.As<Impl, Matrix3x2>(ref this); 76return Unsafe.Add(ref Unsafe.AsRef(in this.X), row)[column]; 86Unsafe.Add(ref this.X, row)[column] = value;
src\libraries\System.Private.CoreLib\src\System\Numerics\Matrix4x4.cs (3)
96Unsafe.SkipInit(out this); 111Unsafe.SkipInit(out this); 610Unsafe.SkipInit(out result);
src\libraries\System.Private.CoreLib\src\System\Numerics\Matrix4x4.Impl.cs (8)
28internal ref Impl AsImpl() => ref Unsafe.As<Matrix4x4, Impl>(ref this); 32internal readonly ref readonly Impl AsROImpl() => ref Unsafe.As<Matrix4x4, Impl>(ref Unsafe.AsRef(in this)); 38public ref Matrix4x4 AsM4x4() => ref Unsafe.As<Impl, Matrix4x4>(ref this); 96return Unsafe.Add(ref Unsafe.AsRef(in this.X), row)[column]; 106Unsafe.Add(ref this.X, row)[column] = value; 1230rotation = Quaternion.CreateFromRotationMatrix(Unsafe.As<Impl, Matrix4x4>(ref matTemp));
src\libraries\System.Private.CoreLib\src\System\Numerics\Quaternion.cs (1)
200return Unsafe.BitCast<Vector128<float>, Quaternion>(result);
src\libraries\System.Private.CoreLib\src\System\Numerics\Quaternion.Extensions.cs (3)
51ref float address = ref Unsafe.AsRef(in quaternion.X); 52return Unsafe.Add(ref address, index); 59Unsafe.Add(ref quaternion.X, index) = value;
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector.cs (66)
44Unsafe.SkipInit(out Vector<T> result); 87return Unsafe.As<Vector<TFrom>, Vector<TTo>>(ref vector); 229Unsafe.SkipInit(out Vector<double> result); 248Unsafe.SkipInit(out Vector<float> result); 334Unsafe.SkipInit(out Vector<int> result); 351Unsafe.SkipInit(out Vector<int> result); 368Unsafe.SkipInit(out Vector<long> result); 385Unsafe.SkipInit(out Vector<long> result); 402Unsafe.SkipInit(out Vector<float> result); 440Unsafe.SkipInit(out Vector<uint> result); 458Unsafe.SkipInit(out Vector<uint> result); 476Unsafe.SkipInit(out Vector<ulong> result); 494Unsafe.SkipInit(out Vector<ulong> result); 561Unsafe.SkipInit(out Vector<T> result); 641Unsafe.SkipInit(out Vector<double> result); 660Unsafe.SkipInit(out Vector<float> result); 684Unsafe.SkipInit(out Vector<double> result); 708Unsafe.SkipInit(out Vector<float> result); 747Unsafe.SkipInit(out Vector<T> result); 838Unsafe.SkipInit(out Vector<T> result); 930Unsafe.SkipInit(out Vector<T> result); 1022Unsafe.SkipInit(out Vector<T> result); 1158ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 1159return Unsafe.ReadUnaligned<Vector<T>>(in address); 1174ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 1175return Unsafe.ReadUnaligned<Vector<T>>(in address); 1187Unsafe.SkipInit(out Vector<T> result); 1207Unsafe.SkipInit(out Vector<T> result); 1250Unsafe.SkipInit(out Vector<double> result); 1266Unsafe.SkipInit(out Vector<float> result); 1285Unsafe.SkipInit(out Vector<float> result); 1311Unsafe.SkipInit(out Vector<sbyte> result); 1336Unsafe.SkipInit(out Vector<short> result); 1361Unsafe.SkipInit(out Vector<int> result); 1387Unsafe.SkipInit(out Vector<byte> result); 1413Unsafe.SkipInit(out Vector<ushort> result); 1439Unsafe.SkipInit(out Vector<uint> result); 1691Unsafe.SkipInit(out Vector<T> result); 1755ref byte address = ref Unsafe.As<T, byte>(ref destination); 1756Unsafe.WriteUnaligned(ref address, source); 1771destination = ref Unsafe.Add(ref destination, (nint)elementOffset); 1772Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 1903Unsafe.SkipInit(out Vector<ushort> lower); 1921Unsafe.SkipInit(out Vector<int> lower); 1939Unsafe.SkipInit(out Vector<long> lower); 1958Unsafe.SkipInit(out Vector<short> lower); 1976Unsafe.SkipInit(out Vector<double> lower); 1995Unsafe.SkipInit(out Vector<uint> lower); 2014Unsafe.SkipInit(out Vector<ulong> lower); 2033Unsafe.SkipInit(out Vector<ushort> upper); 2051Unsafe.SkipInit(out Vector<int> upper); 2069Unsafe.SkipInit(out Vector<long> upper); 2088Unsafe.SkipInit(out Vector<short> upper); 2106Unsafe.SkipInit(out Vector<double> upper); 2125Unsafe.SkipInit(out Vector<uint> upper); 2144Unsafe.SkipInit(out Vector<ulong> upper); 2189ref T address = ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in vector)); 2190return Unsafe.Add(ref address, index); 2197ref T address = ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in vector)); 2198Unsafe.Add(ref address, index) = value;
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector_1.cs (32)
43Unsafe.SkipInit(out this); 66this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref values[0])); 85this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref values[index])); 102this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 120this = Unsafe.ReadUnaligned<Vector<T>>(ref MemoryMarshal.GetReference(values)); 169Unsafe.SkipInit(out Vector<T> result); 257Unsafe.SkipInit(out Vector<T> result); 277Unsafe.SkipInit(out Vector<ulong> result); 300Unsafe.SkipInit(out Vector<ulong> result); 322Unsafe.SkipInit(out Vector<T> result); 341Unsafe.SkipInit(out Vector<T> result); 379Unsafe.SkipInit(out Vector<ulong> result); 520Unsafe.SkipInit(out Vector<T> result); 539Unsafe.SkipInit(out Vector<T> result); 558Unsafe.SkipInit(out Vector<T> result); 585Unsafe.SkipInit(out Vector<ulong> result); 606Unsafe.SkipInit(out Vector<T> result); 625Unsafe.SkipInit(out Vector<T> result); 663Unsafe.SkipInit(out Vector<T> result); 688Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), this); 712Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), this); 728Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this); 742Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this); 850Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this); 865Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (11)
54this = Unsafe.ReadUnaligned<Vector2>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values))); 592Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[0]), this); 620Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[index]), this); 634Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 648Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 674return Vector64.LoadUnsafe(ref Unsafe.AsRef(in X)).Equals(Vector64.LoadUnsafe(ref other.X));
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.Extensions.cs (3)
51ref float address = ref Unsafe.AsRef(in vector.X); 52return Unsafe.Add(ref address, index); 59Unsafe.Add(ref vector.X, index) = value;
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (10)
67this = Unsafe.ReadUnaligned<Vector3>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values))); 601Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[0]), this); 629Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[index]), this); 643Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 657Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.Extensions.cs (3)
51ref float address = ref Unsafe.AsRef(in vector.X); 52return Unsafe.Add(ref address, index); 59Unsafe.Add(ref vector.X, index) = value;
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector4.cs (10)
81this = Unsafe.ReadUnaligned<Vector4>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values))); 700Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[0]), this); 728Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[index]), this); 742Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 756Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector4.Extensions.cs (3)
51ref float address = ref Unsafe.AsRef(in vector.X); 52return Unsafe.Add(ref address, index); 59Unsafe.Add(ref vector.X, index) = value;
src\libraries\System.Private.CoreLib\src\System\Numerics\VectorDebugView_1.cs (23)
23Unsafe.WriteUnaligned(ref items[0], _value); 33Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 43Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 53Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 63Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 73Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 83Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 93Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 103Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 113Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 123Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 133Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Random.Xoshiro256StarStarImpl.cs (1)
142Unsafe.WriteUnaligned(
src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (17)
200ref T refToReturn = ref Unsafe.NullRef<T>(); 212refToReturn = ref Unsafe.As<char, T>(ref Unsafe.As<string>(tmpObject).GetRawStringData()); 213lengthOfUnderlyingSpan = Unsafe.As<string>(tmpObject).Length; 229refToReturn = ref MemoryMarshal.GetArrayDataReference(Unsafe.As<T[]>(tmpObject)); 230lengthOfUnderlyingSpan = Unsafe.As<T[]>(tmpObject).Length; 241Span<T> memoryManagerSpan = Unsafe.As<MemoryManager<T>>(tmpObject).GetSpan(); 268refToReturn = ref Unsafe.Add(ref refToReturn, (IntPtr)(void*)desiredStartIndex); 318ref char stringData = ref Unsafe.Add(ref s.GetRawStringData(), _index); 319return new MemoryHandle(Unsafe.AsPointer(ref stringData), handle); 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); 344return Unsafe.As<MemoryManager<T>>(tmpObject).Pin(_index);
src\libraries\System.Private.CoreLib\src\System\ReadOnlySpan.cs (9)
84_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 120_reference = ref Unsafe.AsRef(in reference); 151return ref Unsafe.Add(ref _reference, (nint)(uint)index /* force zero-extension */); 228return new ReadOnlySpan<T>(ref Unsafe.As<TDerived, T>(ref items._reference), items.Length); 281ref T ret = ref Unsafe.NullRef<T>(); 337Unsafe.AreSame(ref left._reference, ref right._reference); 347return new string(new ReadOnlySpan<char>(ref Unsafe.As<T, char>(ref _reference), _length)); 365return new ReadOnlySpan<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), _length - start); 388return new ReadOnlySpan<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), length);
src\libraries\System.Private.CoreLib\src\System\Reflection\ConstructorInvoker.cs (4)
324copyOfArgs = new(ref Unsafe.AsRef<object?>(pArgStorage), _argCount); 355copyOfArgs = new(ref Unsafe.AsRef<object?>(pStorage), _argCount); 376ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i).GetRawData()) : 377ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i));
src\libraries\System.Private.CoreLib\src\System\Reflection\FieldAccessor.cs (30)
126return Volatile.Read(ref Unsafe.As<byte, object>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset))); 137ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)); 143(void*)Unsafe.As<byte, IntPtr>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 147return Volatile.Read(ref Unsafe.As<IntPtr, object>(ref *(IntPtr*)_addressOrOffset)); 154return RuntimeHelpers.Box(_methodTable, ref Unsafe.AsRef<byte>(_addressOrOffset.ToPointer())); 160ref Unsafe.As<IntPtr, object>(ref *(IntPtr*)_addressOrOffset).GetRawData()); 163return Pointer.Box((void*)Unsafe.As<byte, IntPtr>( 164ref Unsafe.AsRef<byte>(_addressOrOffset.ToPointer())), _fieldInfo.FieldType); 218ref Unsafe.As<byte, object?>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 226ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset), 234ref Unsafe.As<byte, short>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 235Unsafe.As<byte, short>(ref value!.GetRawData())); 242ref Unsafe.As<byte, int>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 243Unsafe.As<byte, int>(ref value!.GetRawData())); 250ref Unsafe.As<byte, long>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 251Unsafe.As<byte, long>(ref value!.GetRawData())); 256Volatile.Write(ref Unsafe.As<IntPtr, object?>(ref *(IntPtr*)_addressOrOffset), value); 262ref Unsafe.AsRef<byte>(_addressOrOffset.ToPointer()), 269ref Unsafe.AsRef<short>(_addressOrOffset.ToPointer()), 270Unsafe.As<byte, short>(ref value!.GetRawData())); 276ref Unsafe.AsRef<int>(_addressOrOffset.ToPointer()), 277Unsafe.As<byte, int>(ref value!.GetRawData())); 283ref Unsafe.AsRef<long>(_addressOrOffset.ToPointer()), 284Unsafe.As<byte, long>(ref value!.GetRawData()));
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBaseInvoker.Constructor.cs (3)
29Span<object?> copyOfArgs = new(ref Unsafe.AsRef<object?>(pStorage), argCount); 46ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i).GetRawData()) : 47ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i));
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBaseInvoker.cs (4)
209copyOfArgs = new(ref Unsafe.AsRef<object?>(pArgStorage), _argCount); 244copyOfArgs = new(ref Unsafe.AsRef<object?>(pStorage), _argCount); 262ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i).GetRawData()) : 263ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i));
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodInvoker.cs (4)
377copyOfArgs = new(ref Unsafe.AsRef<object?>(pArgStorage), _argCount); 408copyOfArgs = new(ref Unsafe.AsRef<object?>(pStorage), _argCount); 429ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i).GetRawData()) : 430ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i));
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs (4)
108ref TaskAwaiter ta = ref Unsafe.As<TAwaiter, TaskAwaiter>(ref awaiter); // relies on TaskAwaiter/TaskAwaiter<T> having the same layout 113ref ConfiguredTaskAwaitable.ConfiguredTaskAwaiter ta = ref Unsafe.As<TAwaiter, ConfiguredTaskAwaitable.ConfiguredTaskAwaiter>(ref awaiter); 292Unsafe.As<AsyncStateMachineBox<TStateMachine>>(s).StateMachine!.MoveNext(); 343return ref Unsafe.As<object?, ExecutionContext?>(ref m_stateObject);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\CastCache.cs (7)
109return ref Unsafe.As<byte, int>(ref Unsafe.AddByteOffset(ref table.GetRawData(), (nint)sizeof(nint))); 123return ref Unsafe.Add(ref tableData, 1); 129return ref Unsafe.As<int, uint>(ref Unsafe.Add(ref tableData, 2)); 136return ref Unsafe.Add(ref Unsafe.As<int, CastCacheEntry>(ref tableData), index + 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\ConditionalWeakTable.cs (3)
528value = Unsafe.As<TValue>(secondary); 579key = Unsafe.As<TKey>(oKey); 580value = Unsafe.As<TValue>(oValue);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\ConfiguredValueTaskAwaitable.cs (6)
63Unsafe.As<IValueTaskSource>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, 85Unsafe.As<IValueTaskSource>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, 105Unsafe.As<IValueTaskSource>(obj).OnCompleted(ThreadPool.s_invokeAsyncStateMachineBox, box, _value._token, 168Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, 190Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, 210Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ThreadPool.s_invokeAsyncStateMachineBox, box, _value._token,
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\GenericCache.cs (5)
110return ref Unsafe.As<byte, Entry>(ref Unsafe.As<RawArrayData>(table).Data); 136return ref Unsafe.Add(ref Unsafe.As<byte, Entry>(ref Unsafe.As<RawArrayData>(table).Data), index + 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs (2)
370return ref Unsafe.As<object?, StateMachineBox<TStateMachine>?>(ref s_perCoreCache[i].Object); 392Unsafe.As<StateMachineBox<TStateMachine>>(s).StateMachine!.MoveNext();
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\QCallHandles.cs (8)
17_ptr = Unsafe.AsPointer(ref s); 33return new ObjectHandleOnStack(Unsafe.AsPointer(ref o)); 44_ptr = Unsafe.AsPointer(ref stackMark); 56_ptr = Unsafe.AsPointer(ref module); 62_ptr = Unsafe.AsPointer(ref module); 75_ptr = Unsafe.AsPointer(ref assembly); 88_ptr = Unsafe.AsPointer(ref type); 94_ptr = Unsafe.AsPointer(ref rth);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\RuntimeHelpers.cs (2)
53dest = Unsafe.As<T[]>(Array.CreateInstanceFromArrayType(array.GetType(), length)); 63ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), offset),
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\Unsafe.cs (1)
729return AsPointer(ref Unsafe.AsRef(in source)) == null;
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\ValueTaskAwaiter.cs (6)
58Unsafe.As<IValueTaskSource>(obj).OnCompleted(s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext | ValueTaskSourceOnCompletedFlags.FlowExecutionContext); 78Unsafe.As<IValueTaskSource>(obj).OnCompleted(s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext); 97Unsafe.As<IValueTaskSource>(obj).OnCompleted(ThreadPool.s_invokeAsyncStateMachineBox, box, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext); 140Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext | ValueTaskSourceOnCompletedFlags.FlowExecutionContext); 160Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext); 179Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ThreadPool.s_invokeAsyncStateMachineBox, box, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\GCHandle.cs (5)
135return (IntPtr)Unsafe.AsPointer(ref Unsafe.As<string>(target).GetRawStringData()); 139return (IntPtr)Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<Array>(target))); 142return (IntPtr)Unsafe.AsPointer(ref target.GetRawData());
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (8)
169void* pRawData = Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(arr)); 178void* pRawData = Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(arr)); 317return Unsafe.ReadUnaligned<short>(addr); 341return Unsafe.ReadUnaligned<int>(addr); 388return Unsafe.ReadUnaligned<long>(addr); 428Unsafe.WriteUnaligned(addr, val); 461Unsafe.WriteUnaligned(addr, val); 512Unsafe.WriteUnaligned(addr, val);
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)
179return (TUnmanagedElement*)Unsafe.AsPointer(ref GetPinnableReference()); 199return ref Unsafe.NullRef<T>();
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\ComVariant.cs (5)
258Unsafe.SkipInit(out ComVariant variant); 382ArgumentOutOfRangeException.ThrowIfGreaterThan(Unsafe.SizeOf<T>(), sizeof(UnionTypes), nameof(T)); 396Unsafe.SkipInit(out ComVariant value); 574ArgumentOutOfRangeException.ThrowIfGreaterThan(Unsafe.SizeOf<T>(), sizeof(UnionTypes), nameof(T)); 579return ref Unsafe.As<UnionTypes, T>(ref _typeUnion._unionTypes);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\PointerArrayMarshaller.cs (5)
53=> Unsafe.As<IntPtr[]>(managed); 84=> Unsafe.As<IntPtr[]>(managed); 159public ReadOnlySpan<IntPtr> GetManagedValuesSource() => Unsafe.As<IntPtr[]>(_managedArray); 180return (TUnmanagedElement*)Unsafe.AsPointer(ref GetPinnableReference()); 200return ref Unsafe.NullRef<byte>();
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (3)
43if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 103if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 148return (TUnmanagedElement*)Unsafe.AsPointer(ref GetPinnableReference());
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (3)
38if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 132if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(managed))) 176return (TUnmanagedElement*)Unsafe.AsPointer(ref GetPinnableReference());
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\MemoryMarshal.cs (24)
39ref Unsafe.As<T, byte>(ref GetReference(span)), 62ref Unsafe.As<T, byte>(ref GetReference(span)), 76Unsafe.As<ReadOnlyMemory<T>, Memory<T>>(ref memory); 95internal static unsafe ref T GetNonNullPinnableReference<T>(Span<T> span) => ref (span.Length != 0) ? ref Unsafe.AsRef(in span._reference) : ref Unsafe.AsRef<T>((void*)1); 102internal static unsafe ref T GetNonNullPinnableReference<T>(ReadOnlySpan<T> span) => ref (span.Length != 0) ? ref Unsafe.AsRef(in span._reference) : ref Unsafe.AsRef<T>((void*)1); 127uint fromSize = (uint)Unsafe.SizeOf<TFrom>(); 128uint toSize = (uint)Unsafe.SizeOf<TTo>(); 155ref Unsafe.As<TFrom, TTo>(ref span._reference), 182uint fromSize = (uint)Unsafe.SizeOf<TFrom>(); 183uint toSize = (uint)Unsafe.SizeOf<TTo>(); 210ref Unsafe.As<TFrom, TTo>(ref GetReference(span)), 229new Span<T>(ref Unsafe.AsRef(in reference), length); 246new ReadOnlySpan<T>(ref Unsafe.AsRef(in reference), length); 292segment = new ArraySegment<T>(Unsafe.As<T[]>(obj), index & ReadOnlyMemory<T>.RemoveFlagsBitMask, length); 301if (Unsafe.As<MemoryManager<T>>(obj).TryGetArray(out ArraySegment<T> tempArraySegment)) 413T[] array = Unsafe.As<T[]>(obj); 481return Unsafe.ReadUnaligned<T>(ref GetReference(source)); 501value = Unsafe.ReadUnaligned<T>(ref GetReference(source)); 520Unsafe.WriteUnaligned(ref GetReference(destination), value); 539Unsafe.WriteUnaligned(ref GetReference(destination), value); 562return ref Unsafe.As<byte, T>(ref GetReference(span)); 584return ref Unsafe.As<byte, T>(ref GetReference(span));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (16)
697Unsafe.SkipInit(out result); 698return NativeType.TryParse(s, out Unsafe.As<NFloat, NativeType>(ref result)); 707Unsafe.SkipInit(out result); 708return NativeType.TryParse(s, out Unsafe.As<NFloat, NativeType>(ref result)); 717Unsafe.SkipInit(out result); 718return NativeType.TryParse(utf8Text, out Unsafe.As<NFloat, NativeType>(ref result)); 734Unsafe.SkipInit(out result); 735return NativeType.TryParse(s, style, provider, out Unsafe.As<NFloat, NativeType>(ref result)); 751Unsafe.SkipInit(out result); 752return NativeType.TryParse(s, style, provider, out Unsafe.As<NFloat, NativeType>(ref result)); 1064Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1088Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent); 1112Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand); 1136Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand); 1923Unsafe.SkipInit(out result); 1924return NativeType.TryParse(utf8Text, style, provider, out Unsafe.As<NFloat, NativeType>(ref result));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeBuffer.cs (6)
197SpanHelpers.Memmove(ref Unsafe.As<T, byte>(ref value), ref *ptr, sizeofT); 251Buffer.Memmove(ref Unsafe.Add(ref structure, i), ref Unsafe.AsRef<T>(ptr + alignedSizeofT * i), 1); 284SpanHelpers.Memmove(ref *ptr, ref Unsafe.As<T, byte>(ref value), sizeofT); 339Buffer.Memmove(ref Unsafe.AsRef<T>(ptr + alignedSizeofT * i), ref Unsafe.Add(ref structure, i), 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\ISimdVector_2.cs (1)
213Unsafe.SkipInit(out TSelf result);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (66)
105return Unsafe.As<Vector128<TFrom>, Vector128<TTo>>(ref vector); 227=> Unsafe.As<Plane, Vector128<float>>(ref value); 235=> Unsafe.As<Quaternion, Vector128<float>>(ref value); 259=> Unsafe.As<Vector4, Vector128<float>>(ref value); 273ref byte address = ref Unsafe.As<Vector<T>, byte>(ref value); 274return Unsafe.ReadUnaligned<Vector128<T>>(ref address); 284ref byte address = ref Unsafe.As<Vector128<float>, byte>(ref value); 285return Unsafe.ReadUnaligned<Vector2>(ref address); 295ref byte address = ref Unsafe.As<Vector128<float>, byte>(ref value); 296return Unsafe.ReadUnaligned<Vector3>(ref address); 305=> Unsafe.As<Vector128<float>, Vector4>(ref value); 320Unsafe.WriteUnaligned(ref Unsafe.As<Vector<T>, byte>(ref result), value); 581Unsafe.SkipInit(out Vector128<float> result); 666Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 693Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 710Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 842return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref values[0])); 863return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref values[index])); 880return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 1099Unsafe.SkipInit(out Vector128<T> result); 1310Unsafe.SkipInit(out Vector128<T> result); 1868ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 1869return Unsafe.ReadUnaligned<Vector128<T>>(in address); 1884ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 1885return Unsafe.ReadUnaligned<Vector128<T>>(in address); 1893LoadUnsafe(ref Unsafe.As<char, ushort>(ref source)); 1901LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset); 2417Unsafe.SkipInit(out Vector128<byte> result); 2442Unsafe.SkipInit(out Vector128<sbyte> result); 2499Unsafe.SkipInit(out Vector128<short> result); 2524Unsafe.SkipInit(out Vector128<ushort> result); 2548Unsafe.SkipInit(out Vector128<int> result); 2573Unsafe.SkipInit(out Vector128<uint> result); 2597Unsafe.SkipInit(out Vector128<float> result); 2621Unsafe.SkipInit(out Vector128<long> result); 2646Unsafe.SkipInit(out Vector128<ulong> result); 2670Unsafe.SkipInit(out Vector128<double> result); 2757ref byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref destination, elementOffset)); 2758Unsafe.WriteUnaligned(ref address, source.AsDouble().ToScalar()); 2771ref byte address = ref Unsafe.As<T, byte>(ref destination); 2772Unsafe.WriteUnaligned(ref address, source); 2787destination = ref Unsafe.Add(ref destination, (nint)elementOffset); 2788Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 2863Unsafe.SkipInit(out Vector256<T> result); 2882Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 3220ref T address = ref Unsafe.As<Vector128<T>, T>(ref Unsafe.AsRef(in vector)); 3221return Unsafe.Add(ref address, index); 3228ref T address = ref Unsafe.As<Vector128<T>, T>(ref Unsafe.AsRef(in vector)); 3229Unsafe.Add(ref address, index) = value; 3235Unsafe.AsRef(in vector._lower) = value; 3241Unsafe.AsRef(in vector._upper) = value;
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128_1.cs (1)
71Unsafe.SkipInit(out Vector128<T> result);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128DebugView_1.cs (23)
22Unsafe.WriteUnaligned(ref items[0], _value); 32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (54)
110return Unsafe.As<Vector256<TFrom>, Vector256<TTo>>(ref vector); 239Unsafe.WriteUnaligned(ref Unsafe.As<Vector256<T>, byte>(ref result), value); 255ref byte address = ref Unsafe.As<Vector256<T>, byte>(ref value); 256return Unsafe.ReadUnaligned<Vector<T>>(ref address); 575Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 602Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 619Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 751return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref values[0])); 772return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref values[index])); 789return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 1077Unsafe.SkipInit(out Vector256<T> result); 1290Unsafe.SkipInit(out Vector256<T> result); 1846ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 1847return Unsafe.ReadUnaligned<Vector256<T>>(in address); 1862ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 1863return Unsafe.ReadUnaligned<Vector256<T>>(in address); 1871LoadUnsafe(ref Unsafe.As<char, ushort>(ref source)); 1879LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset); 2401Unsafe.SkipInit(out Vector256<byte> result); 2426Unsafe.SkipInit(out Vector256<sbyte> result); 2450Unsafe.SkipInit(out Vector256<short> result); 2475Unsafe.SkipInit(out Vector256<ushort> result); 2499Unsafe.SkipInit(out Vector256<int> result); 2524Unsafe.SkipInit(out Vector256<uint> result); 2548Unsafe.SkipInit(out Vector256<float> result); 2572Unsafe.SkipInit(out Vector256<long> result); 2597Unsafe.SkipInit(out Vector256<ulong> result); 2621Unsafe.SkipInit(out Vector256<double> result); 2706ref byte address = ref Unsafe.As<T, byte>(ref destination); 2707Unsafe.WriteUnaligned(ref address, source); 2722destination = ref Unsafe.Add(ref destination, (nint)elementOffset); 2723Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 2795Unsafe.SkipInit(out Vector512<T> result); 2814Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 3150ref T address = ref Unsafe.As<Vector256<T>, T>(ref Unsafe.AsRef(in vector)); 3151return Unsafe.Add(ref address, index); 3158ref T address = ref Unsafe.As<Vector256<T>, T>(ref Unsafe.AsRef(in vector)); 3159Unsafe.Add(ref address, index) = value; 3165Unsafe.AsRef(in vector._lower) = value; 3171Unsafe.AsRef(in vector._upper) = value;
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256_1.cs (1)
70Unsafe.SkipInit(out Vector256<T> result);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256DebugView_1.cs (23)
22Unsafe.WriteUnaligned(ref items[0], _value); 32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (53)
110return Unsafe.As<Vector512<TFrom>, Vector512<TTo>>(ref vector); 239Unsafe.WriteUnaligned(ref Unsafe.As<Vector512<T>, byte>(ref result), value); 255ref byte address = ref Unsafe.As<Vector512<T>, byte>(ref value); 256return Unsafe.ReadUnaligned<Vector<T>>(ref address); 503Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 529Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 545Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 676return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref values[0])); 696return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref values[index])); 713return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 1132Unsafe.SkipInit(out Vector512<T> result); 1331Unsafe.SkipInit(out Vector512<T> result); 1893ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 1894return Unsafe.ReadUnaligned<Vector512<T>>(in address); 1909ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 1910return Unsafe.ReadUnaligned<Vector512<T>>(in address); 1918LoadUnsafe(ref Unsafe.As<char, ushort>(ref source)); 1926LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset); 2447Unsafe.SkipInit(out Vector512<byte> result); 2472Unsafe.SkipInit(out Vector512<sbyte> result); 2496Unsafe.SkipInit(out Vector512<short> result); 2521Unsafe.SkipInit(out Vector512<ushort> result); 2545Unsafe.SkipInit(out Vector512<int> result); 2570Unsafe.SkipInit(out Vector512<uint> result); 2594Unsafe.SkipInit(out Vector512<float> result); 2618Unsafe.SkipInit(out Vector512<long> result); 2643Unsafe.SkipInit(out Vector512<ulong> result); 2667Unsafe.SkipInit(out Vector512<double> result); 2752ref byte address = ref Unsafe.As<T, byte>(ref destination); 2753Unsafe.WriteUnaligned(ref address, source); 2768destination = ref Unsafe.Add(ref destination, (nint)elementOffset); 2769Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 2826Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 3162ref T address = ref Unsafe.As<Vector512<T>, T>(ref Unsafe.AsRef(in vector)); 3163return Unsafe.Add(ref address, index); 3170ref T address = ref Unsafe.As<Vector512<T>, T>(ref Unsafe.AsRef(in vector)); 3171Unsafe.Add(ref address, index) = value; 3177Unsafe.AsRef(in vector._lower) = value; 3183Unsafe.AsRef(in vector._upper) = value;
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512_1.cs (1)
70Unsafe.SkipInit(out Vector512<T> result);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512DebugView_1.cs (23)
22Unsafe.WriteUnaligned(ref items[0], _value); 32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (105)
49Unsafe.SkipInit(out Vector64<T> result); 83Unsafe.SkipInit(out Vector64<T> result); 84Unsafe.AsRef(in result._00) = left._00 & ~right._00; 102return Unsafe.As<Vector64<TFrom>, Vector64<TTo>>(ref vector); 260Unsafe.SkipInit(out Vector64<T> result); 301Unsafe.SkipInit(out Vector64<T> result); 302Unsafe.AsRef(in result._00) = (left._00 & condition._00) | (right._00 & ~condition._00); 314Unsafe.SkipInit(out Vector64<double> result); 333Unsafe.SkipInit(out Vector64<double> result); 351Unsafe.SkipInit(out Vector64<int> result); 369Unsafe.SkipInit(out Vector64<int> result); 387Unsafe.SkipInit(out Vector64<long> result); 405Unsafe.SkipInit(out Vector64<long> result); 423Unsafe.SkipInit(out Vector64<float> result); 442Unsafe.SkipInit(out Vector64<float> result); 461Unsafe.SkipInit(out Vector64<uint> result); 480Unsafe.SkipInit(out Vector64<uint> result); 499Unsafe.SkipInit(out Vector64<ulong> result); 518Unsafe.SkipInit(out Vector64<ulong> result); 546Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 573Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 590Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 601Unsafe.SkipInit(out Vector64<T> result); 723return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref values[0])); 744return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref values[index])); 761return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 779Unsafe.SkipInit(out Vector64<byte> result); 802Unsafe.SkipInit(out Vector64<short> result); 819Unsafe.SkipInit(out Vector64<int> result); 841Unsafe.SkipInit(out Vector64<sbyte> result); 861Unsafe.SkipInit(out Vector64<float> result); 879Unsafe.SkipInit(out Vector64<ushort> result); 897Unsafe.SkipInit(out Vector64<uint> result); 1019Unsafe.SkipInit(out Vector64<T> result); 1188Unsafe.SkipInit(out Vector64<T> result); 1233Unsafe.SkipInit(out Vector64<T> result); 1319Unsafe.SkipInit(out Vector64<T> result); 1360Unsafe.SkipInit(out Vector64<double> result); 1384Unsafe.SkipInit(out Vector64<float> result); 1424Unsafe.SkipInit(out Vector64<T> result); 1487Unsafe.SkipInit(out Vector64<T> result); 1550Unsafe.SkipInit(out Vector64<T> result); 1613Unsafe.SkipInit(out Vector64<T> result); 1719ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 1720return Unsafe.ReadUnaligned<Vector64<T>>(in address); 1735ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 1736return Unsafe.ReadUnaligned<Vector64<T>>(in address); 1742Unsafe.SkipInit(out Vector64<T> result); 1788Unsafe.SkipInit(out Vector64<T> result); 1841Unsafe.SkipInit(out Vector64<T> result); 1862Unsafe.SkipInit(out Vector64<T> result); 1916Unsafe.SkipInit(out Vector64<double> result); 1940Unsafe.SkipInit(out Vector64<float> result); 1959Unsafe.SkipInit(out Vector64<float> result); 1985Unsafe.SkipInit(out Vector64<sbyte> result); 2010Unsafe.SkipInit(out Vector64<short> result); 2035Unsafe.SkipInit(out Vector64<int> result); 2061Unsafe.SkipInit(out Vector64<byte> result); 2087Unsafe.SkipInit(out Vector64<ushort> result); 2113Unsafe.SkipInit(out Vector64<uint> result); 2390Unsafe.SkipInit(out Vector64<byte> result); 2415Unsafe.SkipInit(out Vector64<sbyte> result); 2439Unsafe.SkipInit(out Vector64<short> result); 2464Unsafe.SkipInit(out Vector64<ushort> result); 2488Unsafe.SkipInit(out Vector64<int> result); 2513Unsafe.SkipInit(out Vector64<uint> result); 2537Unsafe.SkipInit(out Vector64<float> result); 2563Unsafe.SkipInit(out Vector64<T> result); 2627ref byte address = ref Unsafe.As<T, byte>(ref destination); 2628Unsafe.WriteUnaligned(ref address, source); 2643destination = ref Unsafe.Add(ref destination, (nint)elementOffset); 2644Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 2719Unsafe.SkipInit(out Vector128<T> result); 2738Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 2796Unsafe.SkipInit(out Vector64<ushort> lower); 2814Unsafe.SkipInit(out Vector64<int> lower); 2832Unsafe.SkipInit(out Vector64<long> lower); 2851Unsafe.SkipInit(out Vector64<short> lower); 2869Unsafe.SkipInit(out Vector64<double> lower); 2888Unsafe.SkipInit(out Vector64<uint> lower); 2907Unsafe.SkipInit(out Vector64<ulong> lower); 2926Unsafe.SkipInit(out Vector64<ushort> upper); 2944Unsafe.SkipInit(out Vector64<int> upper); 2962Unsafe.SkipInit(out Vector64<long> upper); 2981Unsafe.SkipInit(out Vector64<short> upper); 2999Unsafe.SkipInit(out Vector64<double> upper); 3018Unsafe.SkipInit(out Vector64<uint> upper); 3037Unsafe.SkipInit(out Vector64<ulong> upper); 3084ref T address = ref Unsafe.As<Vector64<T>, T>(ref Unsafe.AsRef(in vector)); 3085return Unsafe.Add(ref address, index); 3092ref T address = ref Unsafe.As<Vector64<T>, T>(ref Unsafe.AsRef(in vector)); 3093Unsafe.Add(ref address, index) = value;
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64_1.cs (20)
46Unsafe.SkipInit(out Vector64<T> result); 47Unsafe.AsRef(in result._00) = ulong.MaxValue; 77Unsafe.SkipInit(out Vector64<T> result); 168Unsafe.SkipInit(out Vector64<T> result); 190Unsafe.SkipInit(out Vector64<T> result); 191Unsafe.AsRef(in result._00) = left._00 & right._00; 207Unsafe.SkipInit(out Vector64<T> result); 208Unsafe.AsRef(in result._00) = left._00 | right._00; 222Unsafe.SkipInit(out Vector64<T> result); 241Unsafe.SkipInit(out Vector64<T> result); 282Unsafe.SkipInit(out Vector64<T> result); 283Unsafe.AsRef(in result._00) = left._00 ^ right._00; 315Unsafe.SkipInit(out Vector64<T> result); 335Unsafe.SkipInit(out Vector64<T> result); 355Unsafe.SkipInit(out Vector64<T> result); 385Unsafe.SkipInit(out Vector64<T> result); 386Unsafe.AsRef(in result._00) = ~vector._00; 399Unsafe.SkipInit(out Vector64<T> result); 419Unsafe.SkipInit(out Vector64<T> result); 458Unsafe.SkipInit(out Vector64<T> result);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64DebugView_1.cs (23)
22Unsafe.WriteUnaligned(ref items[0], _value); 32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\VectorMath.cs (62)
79TVectorUInt64 n = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(dn); 101TVectorDouble ret = poly * Unsafe.BitCast<TVectorUInt64, TVectorDouble>((n + TVectorUInt64.Create(V_DP64_BIAS)) << 52); 104if (TVectorUInt64.GreaterThanAny(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(TVectorDouble.Abs(x)), TVectorUInt64.Create(V_ARG_MAX))) 187TVectorUInt64 nl = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(dnl); 188TVectorUInt64 nu = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(dnu); 223Unsafe.BitCast<TVectorUInt64, TVectorDouble>(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(polyl) + (nl << 52)), 224Unsafe.BitCast<TVectorUInt64, TVectorDouble>(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(polyu) + (nu << 52)) 228if (TVectorUInt32.GreaterThanAny(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(TVectorSingle.Abs(x)), TVectorUInt32.Create(V_ARG_MAX))) 309TVectorUInt64 specialMask = TVectorUInt64.GreaterThanOrEqual(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_MIN), TVectorUInt64.Create(V_MAX - V_MIN)); 313TVectorInt64 xBits = Unsafe.BitCast<TVectorDouble, TVectorInt64>(x); 316TVectorDouble lessThanZeroMask = Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.LessThan(xBits, TVectorInt64.Zero)); 325TVectorDouble zeroMask = Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(xBits << 1, TVectorInt64.Zero)); 336| Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.GreaterThanOrEqual(xBits, TVectorInt64.Create((long)double.PositiveInfinityBits))); 339TVectorDouble subnormalMask = TVectorDouble.AndNot(Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask), temp); 344Unsafe.BitCast<TVectorUInt64, TVectorDouble>(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x * 4503599627370496.0) - TVectorUInt64.Create(52ul << 52)), 348specialMask = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(temp); 352TVectorUInt64 vx = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_OFF); 353TVectorDouble n = ConvertToDouble<TVectorInt64, TVectorDouble>(Unsafe.BitCast<TVectorUInt64, TVectorInt64>(vx) >> 52); 357TVectorDouble r = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(vx) - TVectorDouble.One; 379Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask), 464TVectorUInt32 specialMask = TVectorUInt32.GreaterThanOrEqual(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_MIN), TVectorUInt32.Create(V_MAX - V_MIN)); 493TVectorSingle subnormalMask = TVectorSingle.AndNot(Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask), temp); 497Unsafe.BitCast<TVectorUInt32, TVectorSingle>(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x * 8388608.0f) - TVectorUInt32.Create(23u << 23)), 501specialMask = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(temp); 504TVectorUInt32 vx = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_OFF); 505TVectorSingle n = ConvertToSingle<TVectorInt32, TVectorSingle>(Unsafe.BitCast<TVectorUInt32, TVectorInt32>(vx) >> 23); 509TVectorSingle r = Unsafe.BitCast<TVectorUInt32, TVectorSingle>(vx) - TVectorSingle.Create(1.0f); 522Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask), 589TVectorUInt64 specialMask = TVectorUInt64.GreaterThanOrEqual(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_MIN), TVectorUInt64.Create(V_MAX - V_MIN)); 593TVectorInt64 xBits = Unsafe.BitCast<TVectorDouble, TVectorInt64>(x); 596TVectorDouble lessThanZeroMask = Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.LessThan(xBits, TVectorInt64.Zero)); 605TVectorDouble zeroMask = Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(xBits << 1, TVectorInt64.Zero)); 616| Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.GreaterThanOrEqual(xBits, TVectorInt64.Create((long)double.PositiveInfinityBits))); 619TVectorDouble subnormalMask = TVectorDouble.AndNot(Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask), temp); 624Unsafe.BitCast<TVectorUInt64, TVectorDouble>(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x * 4503599627370496.0) - TVectorUInt64.Create(52ul << 52)), 628specialMask = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(temp); 632TVectorUInt64 vx = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_OFF); 633TVectorDouble n = ConvertToDouble<TVectorInt64, TVectorDouble>(Unsafe.BitCast<TVectorUInt64, TVectorInt64>(vx) >> 52); 637TVectorDouble r = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(vx) - TVectorDouble.One; 659Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask), 738TVectorUInt32 specialMask = TVectorUInt32.GreaterThanOrEqual(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_MIN), TVectorUInt32.Create(V_MAX - V_MIN)); 742TVectorInt32 xBits = Unsafe.BitCast<TVectorSingle, TVectorInt32>(x); 745TVectorSingle lessThanZeroMask = Unsafe.BitCast<TVectorInt32, TVectorSingle>(TVectorInt32.LessThan(xBits, TVectorInt32.Zero)); 754TVectorSingle zeroMask = Unsafe.BitCast<TVectorInt32, TVectorSingle>(TVectorInt32.Equals(xBits << 1, TVectorInt32.Zero)); 765| Unsafe.BitCast<TVectorInt32, TVectorSingle>(TVectorInt32.GreaterThanOrEqual(xBits, TVectorInt32.Create((int)float.PositiveInfinityBits))); 768TVectorSingle subnormalMask = TVectorSingle.AndNot(Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask), temp); 773Unsafe.BitCast<TVectorUInt32, TVectorSingle>(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x * 8388608.0f) - TVectorUInt32.Create(23u << 23)), 777specialMask = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(temp); 781TVectorUInt32 vx = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_OFF); 782TVectorSingle n = ConvertToSingle<TVectorInt32, TVectorSingle>(Unsafe.BitCast<TVectorUInt32, TVectorInt32>(vx) >> 23); 786TVectorSingle r = Unsafe.BitCast<TVectorUInt32, TVectorSingle>(vx) - TVectorSingle.One; 802Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask), 813Unsafe.SkipInit(out TVectorDouble result); 844Unsafe.SkipInit(out TVectorSingle result); 875Unsafe.SkipInit(out TVectorSingle result); 910Unsafe.SkipInit(out (TVectorDouble, TVectorDouble) result);
src\libraries\System.Private.CoreLib\src\System\SByte.cs (3)
348result = (sbyte)Unsafe.Add(ref MemoryMarshal.GetReference(source), source.Length - sizeof(sbyte)); 432Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 450Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1SearchValues.cs (6)
21Debug.Assert(Unsafe.SizeOf<T>() == Unsafe.SizeOf<TImpl>()); 38SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 42SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 46SpanHelpers.LastIndexOfValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 50SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2CharPackedIgnoreCaseSearchValues.cs (2)
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\Any2SearchValues.cs (6)
21Debug.Assert(Unsafe.SizeOf<T>() == Unsafe.SizeOf<TImpl>()); 38SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 42SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 46SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 50SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3SearchValues.cs (6)
21Debug.Assert(Unsafe.SizeOf<T>() == Unsafe.SizeOf<TImpl>()); 38SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 42SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 46SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 50SpanHelpers.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 (6)
21Debug.Assert(Unsafe.SizeOf<T>() == Unsafe.SizeOf<TImpl>()); 41SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 45SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 49SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 53SpanHelpers.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 (6)
21Debug.Assert(Unsafe.SizeOf<T>() == Unsafe.SizeOf<TImpl>()); 42SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 46SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 50SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 54SpanHelpers.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\AsciiCharSearchValues.cs (6)
33ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 41ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 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);
src\libraries\System.Private.CoreLib\src\System\SearchValues\BitmapCharSearchValues.cs (5)
73ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 77while (!Unsafe.AreSame(ref cur, ref searchSpaceEnd)) 82return (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref cur) / sizeof(char)); 85cur = ref Unsafe.Add(ref cur, 1); 98char c = Unsafe.Add(ref searchSpace, searchSpaceLength);
src\libraries\System.Private.CoreLib\src\System\SearchValues\IndexOfAnyAsciiSearcher.cs (102)
121TryIndexOfAny<DontNegate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index); 125TryIndexOfAny<Negate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index); 129TryLastIndexOfAny<DontNegate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index); 133TryLastIndexOfAny<Negate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index); 220ref short searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 222while (!Unsafe.AreSame(ref currentSearchSpace, ref searchSpaceEnd)) 230currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 1); 250ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - (2 * Vector256<short>.Count)); 263currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count); 265while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 272ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector256<short>.Count); 274ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 303ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - (2 * Vector128<short>.Count)); 316currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count); 318while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 325ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<short>.Count); 327ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 355char c = (char)Unsafe.Add(ref searchSpace, i); 365ref short currentSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 381ref short twoVectorsAfterStart = ref Unsafe.Add(ref searchSpace, 2 * Vector256<short>.Count); 385currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, 2 * Vector256<short>.Count); 396while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref twoVectorsAfterStart)); 403ref short oneVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector256<short>.Count); 405ref short secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAfterStart) 406? ref Unsafe.Subtract(ref currentSearchSpace, Vector256<short>.Count) 432ref short twoVectorsAfterStart = ref Unsafe.Add(ref searchSpace, 2 * Vector128<short>.Count); 436currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, 2 * Vector128<short>.Count); 447while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref twoVectorsAfterStart)); 454ref short oneVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<short>.Count); 456ref short secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAfterStart) 457? ref Unsafe.Subtract(ref currentSearchSpace, Vector128<short>.Count) 501ref byte searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 503while (!Unsafe.AreSame(ref currentSearchSpace, ref searchSpaceEnd)) 511currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 1); 529ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector256<byte>.Count); 541currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<byte>.Count); 543while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd)); 550ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count); 552ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd) 578ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count); 590currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<byte>.Count); 592while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd)); 599ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - sizeof(ulong)); 601ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd) 605ulong source0 = Unsafe.ReadUnaligned<ulong>(ref firstVector); 606ulong source1 = Unsafe.ReadUnaligned<ulong>(ref halfVectorAwayFromEnd); 629byte b = Unsafe.Add(ref searchSpace, i); 639ref byte currentSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 653ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector256<byte>.Count); 657currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector256<byte>.Count); 667while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart)); 674ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count); 676ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart) 677? ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count) 702ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count); 706currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count); 716while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart)); 723ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, sizeof(ulong)); 725ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart) 726? ref Unsafe.Subtract(ref currentSearchSpace, sizeof(ulong)) 729ulong source0 = Unsafe.ReadUnaligned<ulong>(ref searchSpace); 730ulong source1 = Unsafe.ReadUnaligned<ulong>(ref secondVector); 771ref byte searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 773while (!Unsafe.AreSame(ref currentSearchSpace, ref searchSpaceEnd)) 781currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 1); 800ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector256<byte>.Count); 812currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<byte>.Count); 814while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd)); 821ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count); 823ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd) 852ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count); 864currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<byte>.Count); 866while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd)); 873ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - sizeof(ulong)); 875ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd) 879ulong source0 = Unsafe.ReadUnaligned<ulong>(ref firstVector); 880ulong source1 = Unsafe.ReadUnaligned<ulong>(ref halfVectorAwayFromEnd); 903byte b = Unsafe.Add(ref searchSpace, i); 913ref byte currentSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 928ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector256<byte>.Count); 932currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector256<byte>.Count); 942while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart)); 949ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count); 951ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart) 952? ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count) 980ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count); 984currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count); 994while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart)); 1001ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, sizeof(ulong)); 1003ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart) 1004? ref Unsafe.Subtract(ref currentSearchSpace, sizeof(ulong)) 1007ulong source0 = Unsafe.ReadUnaligned<ulong>(ref searchSpace); 1008ulong source1 = Unsafe.ReadUnaligned<ulong>(ref secondVector); 1145return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 1160return offsetInVector - Vector128<short>.Count + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref secondVector) / (nuint)sizeof(T)); 1176return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 1198return offsetInVector - Vector256<short>.Count + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref secondVector) / (nuint)sizeof(T)); 1321return (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 1329return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 1344return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 1358return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / (nuint)sizeof(T)); 1379return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / (nuint)sizeof(T));
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (69)
82Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) |= (byte)(1u << (value >> VectorizedIndexShift)); 86Unsafe.Add(ref charMap, value & PortableIndexMask) |= 1u << (value >> PortableIndexShift); 92? (Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) & (1u << (value >> VectorizedIndexShift))) != 0 93: (Unsafe.Add(ref charMap, value & PortableIndexMask) & (1u << (value >> PortableIndexShift))) != 0; 104ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(values)), 408ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 410Vector256<byte> charMap256 = Vector256.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 419ref char lastStartVector = ref Unsafe.Subtract(ref searchSpaceEnd, 64); 423Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref cur, ref Unsafe.Add(ref cur, Vector512<ushort>.Count)); 433cur = ref Unsafe.Add(ref cur, 64); 435if (Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector)) 437if (Unsafe.AreSame(ref cur, ref searchSpaceEnd)) 453Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref searchSpace, ref Unsafe.Subtract(ref searchSpaceEnd, Vector512<ushort>.Count)); 470Vector256<byte> result = ContainsMask32CharsAvx512(charMap256, ref searchSpace, ref Unsafe.Subtract(ref searchSpaceEnd, Vector256<ushort>.Count)); 492ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 495Vector128<byte> charMapLower = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 496Vector128<byte> charMapUpper = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map), (nuint)Vector128<byte>.Count); 505ref char lastStartVectorAvx2 = ref Unsafe.Subtract(ref searchSpaceEnd, 32); 519cur = ref Unsafe.Add(ref cur, 32); 521if (Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVectorAvx2)) 523if (Unsafe.AreSame(ref cur, ref searchSpaceEnd)) 528if (Unsafe.ByteOffset(ref cur, ref searchSpaceEnd) > 16 * sizeof(char)) 538cur = ref Unsafe.Subtract(ref searchSpaceEnd, 16); 545ref char lastStartVector = ref Unsafe.Subtract(ref searchSpaceEnd, 16); 559cur = ref Unsafe.Add(ref cur, 16); 561if (Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector)) 563if (Unsafe.AreSame(ref cur, ref searchSpaceEnd)) 583ref char cur = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 585Vector256<byte> charMap256 = Vector256.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 593ref char lastStartVector = ref Unsafe.Add(ref searchSpace, 64); 597Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 64 * sizeof(char)); 599cur = ref Unsafe.Subtract(ref cur, 64); 601Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref cur, ref Unsafe.Add(ref cur, Vector512<ushort>.Count)); 611if (!Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector)) 613if (Unsafe.AreSame(ref cur, ref searchSpace)) 626Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 32 * sizeof(char)); 630Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref searchSpace, ref Unsafe.Subtract(ref cur, Vector512<ushort>.Count)); 644Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 16 * sizeof(char)); 648Vector256<byte> result = ContainsMask32CharsAvx512(charMap256, ref searchSpace, ref Unsafe.Subtract(ref cur, Vector256<ushort>.Count)); 670ref char cur = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 672Vector128<byte> charMapLower = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 673Vector128<byte> charMapUpper = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map), (nuint)Vector128<byte>.Count); 682ref char lastStartVectorAvx2 = ref Unsafe.Add(ref searchSpace, 32); 686Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 32 * sizeof(char)); 688cur = ref Unsafe.Subtract(ref cur, 32); 700if (!Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVectorAvx2)) 702if (Unsafe.AreSame(ref cur, ref searchSpace)) 707if (Unsafe.ByteOffset(ref searchSpace, ref cur) > 16 * sizeof(char)) 717cur = ref Unsafe.Add(ref searchSpace, 16); 724ref char lastStartVector = ref Unsafe.Add(ref searchSpace, 16); 728Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 16 * sizeof(char)); 730cur = ref Unsafe.Subtract(ref cur, 16); 742if (!Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector)) 744if (Unsafe.AreSame(ref cur, ref searchSpace)) 759(int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref cur) / sizeof(char)); 769if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 797if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 818if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 846if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 867if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 899if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 918if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 950if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index))) 965ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 968while (!Unsafe.AreSame(ref cur, ref searchSpaceEnd)) 976cur = ref Unsafe.Add(ref cur, 1); 988char c = Unsafe.Add(ref searchSpace, i);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (11)
90return Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(hashEntries), (nuint)offset) == value; 100ref Unsafe.As<ProbabilisticMap, uint>(ref Map), 236ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength); 246while (!Unsafe.AreSame(ref cur, ref searchSpaceEnd)) 251return (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref cur) / sizeof(char)); 254cur = ref Unsafe.Add(ref cur, 1); 259while (!Unsafe.AreSame(ref cur, ref searchSpaceEnd)) 264return (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref cur) / sizeof(char)); 267cur = ref Unsafe.Add(ref cur, 1); 288char c = Unsafe.Add(ref searchSpace, searchSpaceLength); 299char c = Unsafe.Add(ref searchSpace, searchSpaceLength);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticWithAsciiCharSearchValues.cs (6)
60ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 70ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 109ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 159ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 169ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 198ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)),
src\libraries\System.Private.CoreLib\src\System\SearchValues\RangeCharSearchValues.cs (6)
45ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(span)), 46Unsafe.As<char, ushort>(ref _lowInclusive), 47Unsafe.As<char, ushort>(ref _highInclusive), 55ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(span)), 56Unsafe.As<char, ushort>(ref _lowInclusive), 57Unsafe.As<char, ushort>(ref _highInclusive),
src\libraries\System.Private.CoreLib\src\System\SearchValues\SearchValues.T.cs (1)
59"\"" + new string(Unsafe.As<T[], char[]>(ref values)) + "\"" :
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\AsciiStringSearchValuesTeddyBase.cs (48)
203ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationVector128); 205searchSpace = ref Unsafe.Add(ref searchSpace, MatchStartOffsetN2); 223searchSpace = ref Unsafe.Add(ref searchSpace, CharsPerIterationVector128); 225if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpaceStart)) 227if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpaceStart, CharsPerIterationVector128))) 255ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx2); 257searchSpace = ref Unsafe.Add(ref searchSpace, MatchStartOffsetN2); 275searchSpace = ref Unsafe.Add(ref searchSpace, CharsPerIterationAvx2); 277if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpaceStart)) 279if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpaceStart, CharsPerIterationAvx2))) 307ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx512); 309searchSpace = ref Unsafe.Add(ref searchSpace, MatchStartOffsetN2); 327searchSpace = ref Unsafe.Add(ref searchSpace, CharsPerIterationAvx512); 329if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpaceStart)) 331if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpaceStart, CharsPerIterationAvx512))) 362ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationVector128); 364searchSpace = ref Unsafe.Add(ref searchSpace, MatchStartOffsetN3); 397searchSpace = ref Unsafe.Add(ref searchSpace, CharsPerIterationVector128); 399if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpaceStart)) 401if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpaceStart, CharsPerIterationVector128))) 432ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx2); 434searchSpace = ref Unsafe.Add(ref searchSpace, MatchStartOffsetN3); 454searchSpace = ref Unsafe.Add(ref searchSpace, CharsPerIterationAvx2); 456if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpaceStart)) 458if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpaceStart, CharsPerIterationAvx2))) 487ref char lastSearchSpaceStart = ref Unsafe.Add(ref searchSpace, span.Length - CharsPerIterationAvx512); 489searchSpace = ref Unsafe.Add(ref searchSpace, MatchStartOffsetN3); 509searchSpace = ref Unsafe.Add(ref searchSpace, CharsPerIterationAvx512); 511if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpaceStart)) 513if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpaceStart, CharsPerIterationAvx512))) 546ref char matchRef = ref Unsafe.Add(ref searchSpace, matchOffset - matchStartOffset); 547offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref matchRef) / 2); 564? StartsWith<TCaseSensitivity>(ref matchRef, lengthRemaining, Unsafe.As<string[]>(bucket)) 565: StartsWith<TCaseSensitivity>(ref matchRef, lengthRemaining, Unsafe.As<string>(bucket))) 593ref char matchRef = ref Unsafe.Add(ref searchSpace, matchOffset - matchStartOffset); 594offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref matchRef) / 2); 609? StartsWith<TCaseSensitivity>(ref matchRef, lengthRemaining, Unsafe.As<string[]>(bucket)) 610: StartsWith<TCaseSensitivity>(ref matchRef, lengthRemaining, Unsafe.As<string>(bucket))) 638ref char matchRef = ref Unsafe.Add(ref searchSpace, matchOffset - matchStartOffset); 639offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref matchRef) / 2); 654? StartsWith<TCaseSensitivity>(ref matchRef, lengthRemaining, Unsafe.As<string[]>(bucket)) 655: StartsWith<TCaseSensitivity>(ref matchRef, lengthRemaining, Unsafe.As<string>(bucket)))
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasick.cs (13)
100ref Unsafe.As<char, short>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), i)), 102ref Unsafe.AsRef(in _startingAsciiChars)); 123char c = TCaseSensitivity.TransformInput(Unsafe.Add(ref MemoryMarshal.GetReference(span), i)); 128ref AhoCorasickNode node = ref Unsafe.Add(ref nodes, (uint)nodeIndex); 136int matchLength = Unsafe.Add(ref nodes, (uint)nodeIndex).MatchLength; 209ref Unsafe.As<char, short>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), i)), 211ref Unsafe.AsRef(in _startingAsciiChars)); 242c = Unsafe.Add(ref MemoryMarshal.GetReference(span), i); 247char.IsLowSurrogate(lowSurrogate = Unsafe.Add(ref MemoryMarshal.GetReference(span), i + 1))) 277ref AhoCorasickNode node = ref Unsafe.Add(ref nodes, (uint)nodeIndex); 285int matchLength = Unsafe.Add(ref nodes, (uint)nodeIndex).MatchLength;
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasickNode.cs (2)
44int[] table = Unsafe.As<int[]>(children); 56return Unsafe.As<Dictionary<char, int>>(children).TryGetValue(c, out index);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (7)
120ref char end = ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (uint)(span.Length - hashLength)); 125hash = (hash << HashShiftPerElement) + TCaseSensitivity.TransformInput(Unsafe.Add(ref current, i)); 135if (Unsafe.Add(ref bucketsRef, hash % BucketCount) is string[] bucket) 137int startOffset = (int)((nuint)Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref current) / sizeof(char)); 145if (!Unsafe.IsAddressLessThan(ref current, ref end)) 151char next = TCaseSensitivity.TransformInput(Unsafe.Add(ref current, (uint)hashLength)); 155current = ref Unsafe.Add(ref current, 1);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\StringSearchValuesHelper.cs (28)
30nint currentByteOffset = Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref searchSpace); 74if (TCaseSensitivity.TransformInput(Unsafe.Add(ref matchStart, i)) != candidate[i]) 138ref byte first = ref Unsafe.As<char, byte>(ref matchStart); 139ref byte second = ref Unsafe.As<char, byte>(ref candidate.GetRawStringData()); 152ulong differentBits = Unsafe.ReadUnaligned<ulong>(ref first) - Unsafe.ReadUnaligned<ulong>(ref second); 153differentBits |= Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref first, offset)) - Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref second, offset)); 164return Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref first, offset)) 165== Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref second, offset)); 198ref byte first = ref Unsafe.As<char, byte>(ref matchStart); 199ref byte second = ref Unsafe.As<char, byte>(ref candidate.GetRawStringData()); 206ulong differentBits = (Unsafe.ReadUnaligned<ulong>(ref first) & CaseMask) - Unsafe.ReadUnaligned<ulong>(ref second); 207differentBits |= (Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref first, offset)) & CaseMask) - Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref second, offset)); 214uint differentBits = (Unsafe.ReadUnaligned<uint>(ref first) & CaseMask) - Unsafe.ReadUnaligned<uint>(ref second); 215differentBits |= (Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref first, offset)) & CaseMask) - Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref second, offset));
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (32)
86ref char lastSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceMinusValueTailLength - Vector512<ushort>.Count); 104searchSpace = ref Unsafe.Add(ref searchSpace, Vector512<ushort>.Count); 106if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpace)) 108if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpace, Vector512<ushort>.Count))) 134ref char lastSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceMinusValueTailLength - Vector256<ushort>.Count); 151searchSpace = ref Unsafe.Add(ref searchSpace, Vector256<ushort>.Count); 153if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpace)) 155if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpace, Vector256<ushort>.Count))) 181ref char lastSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceMinusValueTailLength - Vector128<ushort>.Count); 198searchSpace = ref Unsafe.Add(ref searchSpace, Vector128<ushort>.Count); 200if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpace)) 202if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpace, Vector128<ushort>.Count))) 229ref char cur = ref Unsafe.Add(ref searchSpace, i); 250Vector128<ushort> cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16()); 251Vector128<ushort> cmpCh3 = Vector128.Equals(ch3, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16()); 263Vector128<ushort> cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion); 264Vector128<ushort> cmpCh3 = Vector128.Equals(ch3, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion); 278Vector256<ushort> cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16()); 279Vector256<ushort> cmpCh3 = Vector256.Equals(ch3, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16()); 287Vector256<ushort> cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion); 288Vector256<ushort> cmpCh3 = Vector256.Equals(ch3, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion); 301Vector512<ushort> cmpCh2 = Vector512.Equals(ch2, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16()); 302Vector512<ushort> cmpCh3 = Vector512.Equals(ch3, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16()); 310Vector512<ushort> cmpCh2 = Vector512.Equals(ch2, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion); 311Vector512<ushort> cmpCh3 = Vector512.Equals(ch3, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion); 326ref char matchRef = ref Unsafe.AddByteOffset(ref searchSpace, bitPos); 336offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref searchSpaceStart, ref matchRef) / 2); 358ref char matchRef = ref Unsafe.AddByteOffset(ref searchSpace, bitPos); 368offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref searchSpaceStart, ref matchRef) / 2);
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 (9)
89_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */); 156return ref Unsafe.Add(ref _reference, (nint)(uint)index /* force zero-extension */); 274ref T ret = ref Unsafe.NullRef<T>(); 287SpanHelpers.ClearWithReferences(ref Unsafe.As<T, IntPtr>(ref _reference), (uint)_length * (nuint)(sizeof(T) / sizeof(nuint))); 291SpanHelpers.ClearWithoutReferences(ref Unsafe.As<T, byte>(ref _reference), (uint)_length * (nuint)sizeof(T)); 355Unsafe.AreSame(ref left._reference, ref right._reference); 371return new string(new ReadOnlySpan<char>(ref Unsafe.As<T, char>(ref _reference), _length)); 389return new Span<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), _length - start); 417return new Span<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), length);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.BinarySearch.cs (1)
40int c = comparable.CompareTo(Unsafe.Add(ref spanStart, i));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Byte.cs (75)
36ref byte valueTail = ref Unsafe.Add(ref value, 1); 42int relativeIndex = IndexOfValueType(ref Unsafe.Add(ref searchSpace, offset), valueHead, remainingSearchSpaceLength); 54ref Unsafe.Add(ref searchSpace, offset + 1), 70byte ch2Val = Unsafe.Add(ref value, valueTailLength); 73ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 116ref Unsafe.Add(ref searchSpace, offset + bitPos), 131byte ch2Val = Unsafe.Add(ref value, valueTailLength); 134ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 177ref Unsafe.Add(ref searchSpace, offset + bitPos), 192byte ch2Val = Unsafe.Add(ref value, valueTailLength); 195ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 238ref Unsafe.Add(ref searchSpace, offset + bitPos), 272ref byte valueTail = ref Unsafe.Add(ref value, 1); 288ref Unsafe.Add(ref searchSpace, relativeIndex + 1), 305byte ch2Val = Unsafe.Add(ref value, valueTailLength); 308ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 328ref Unsafe.Add(ref searchSpace, offset + highestSetBitIndex), 352byte ch2Val = Unsafe.Add(ref value, valueTailLength); 355ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 375ref Unsafe.Add(ref searchSpace, offset + highestSetBitIndex), 399byte ch2Val = Unsafe.Add(ref value, valueTailLength); 402ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 424ref Unsafe.Add(ref searchSpace, offset + highestSetBitIndex), 786differentBits |= (uint)Unsafe.AddByteOffset(ref first, offset) - (uint)Unsafe.AddByteOffset(ref second, offset); 804if (!Unsafe.AreSame(ref first, ref second)) 968if (Unsafe.AreSame(ref first, ref second)) 1013int result = Unsafe.AddByteOffset(ref first, offset).CompareTo(Unsafe.AddByteOffset(ref second, offset)); 1054int result = Unsafe.AddByteOffset(ref first, offset).CompareTo(Unsafe.AddByteOffset(ref second, offset)); 1091int result = Unsafe.AddByteOffset(ref first, offset).CompareTo(Unsafe.AddByteOffset(ref second, offset)); 1140int result = Unsafe.AddByteOffset(ref first, offset).CompareTo(Unsafe.AddByteOffset(ref second, offset)); 1171if (Unsafe.Add(ref first, 1) != Unsafe.Add(ref second, 1)) 1176if (i > 2 && Unsafe.Add(ref first, 2) != Unsafe.Add(ref second, 2)) 1185if (Unsafe.Add(ref first, i + 0) != Unsafe.Add(ref second, i + 0)) goto Found0; 1186if (Unsafe.Add(ref first, i + 1) != Unsafe.Add(ref second, i + 1)) goto Found1; 1187if (Unsafe.Add(ref first, i + 2) != Unsafe.Add(ref second, i + 2)) goto Found2; 1188if (Unsafe.Add(ref first, i + 3) != Unsafe.Add(ref second, i + 3)) goto Found3; 1254=> Unsafe.ReadUnaligned<ushort>(ref start); 1258=> Unsafe.ReadUnaligned<uint>(ref start); 1262=> Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref start, offset)); 1266=> Unsafe.ReadUnaligned<nuint>(ref start); 1270=> Unsafe.ReadUnaligned<nuint>(ref Unsafe.AddByteOffset(ref start, offset)); 1274=> Unsafe.ReadUnaligned<Vector128<byte>>(ref Unsafe.AddByteOffset(ref start, offset)); 1278=> Unsafe.ReadUnaligned<Vector256<byte>>(ref Unsafe.AddByteOffset(ref start, offset)); 1429long tempFirst = Unsafe.ReadUnaligned<long>(ref Unsafe.Add(ref buf, offset)); 1430long tempLast = Unsafe.ReadUnaligned<long>(ref Unsafe.Add(ref buf, lastOffset)); 1433Unsafe.WriteUnaligned(ref Unsafe.Add(ref buf, offset), BinaryPrimitives.ReverseEndianness(tempLast)); 1434Unsafe.WriteUnaligned(ref Unsafe.Add(ref buf, lastOffset), BinaryPrimitives.ReverseEndianness(tempFirst)); 1448int tempFirst = Unsafe.ReadUnaligned<int>(ref Unsafe.Add(ref buf, offset)); 1449int tempLast = Unsafe.ReadUnaligned<int>(ref Unsafe.Add(ref buf, lastOffset)); 1452Unsafe.WriteUnaligned(ref Unsafe.Add(ref buf, offset), BinaryPrimitives.ReverseEndianness(tempLast)); 1453Unsafe.WriteUnaligned(ref Unsafe.Add(ref buf, lastOffset), BinaryPrimitives.ReverseEndianness(tempFirst)); 1464ReverseInner(ref Unsafe.Add(ref buf, offset), (nuint)remainder);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.ByteMemOps.cs (98)
43if ((nuint)Unsafe.ByteOffset(ref src, ref dest) < len || 44(nuint)Unsafe.ByteOffset(ref dest, ref src) < len) 49ref byte srcEnd = ref Unsafe.Add(ref src, len); 50ref byte destEnd = ref Unsafe.Add(ref dest, len); 61Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<Block16>(ref src)); 74Unsafe.WriteUnaligned(ref Unsafe.Add(ref dest, 16), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref src, 16))); 87Unsafe.WriteUnaligned(ref Unsafe.Add(ref dest, 32), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref src, 32))); 102Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -16), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref srcEnd, -16))); 120Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<long>(ref src)); 121Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -8), Unsafe.ReadUnaligned<long>(ref Unsafe.Add(ref srcEnd, -8))); 135Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<int>(ref src)); 136Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -4), Unsafe.ReadUnaligned<int>(ref Unsafe.Add(ref srcEnd, -4))); 147Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -2), Unsafe.ReadUnaligned<short>(ref Unsafe.Add(ref srcEnd, -2))); 165nuint misalignedElements = 64 - Unsafe.OpportunisticMisalignment(ref dest, 64); 166Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<Block64>(ref src)); 167src = ref Unsafe.Add(ref src, misalignedElements); 168dest = ref Unsafe.Add(ref dest, misalignedElements); 180Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<Block64>(ref src)); 208dest = ref Unsafe.Add(ref dest, 64); 209src = ref Unsafe.Add(ref src, 64); 218Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -16), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref srcEnd, -16))); 233if (Unsafe.AreSame(ref dest, ref src)) 236_ = Unsafe.ReadUnaligned<byte>(ref dest); 243_ = Unsafe.ReadUnaligned<byte>(ref dest); 244_ = Unsafe.ReadUnaligned<byte>(ref src); 257ref byte destEnd = ref Unsafe.Add(ref dest, len); 268Unsafe.WriteUnaligned<Block16>(ref dest, default); 281Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref dest, 16), default); 294Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref dest, 32), default); 309Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref destEnd, -16), default); 327Unsafe.WriteUnaligned<long>(ref dest, 0); 328Unsafe.WriteUnaligned<long>(ref Unsafe.Add(ref destEnd, -8), 0); 342Unsafe.WriteUnaligned<int>(ref dest, 0); 343Unsafe.WriteUnaligned<int>(ref Unsafe.Add(ref destEnd, -4), 0); 354Unsafe.WriteUnaligned<short>(ref Unsafe.Add(ref destEnd, -2), 0); 369nuint misalignedElements = 64 - Unsafe.OpportunisticMisalignment(ref dest, 64); 370Unsafe.WriteUnaligned<Block64>(ref dest, default); 371dest = ref Unsafe.Add(ref dest, misalignedElements); 382Unsafe.WriteUnaligned<Block64>(ref dest, default); 410dest = ref Unsafe.Add(ref dest, 64); 419Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref destEnd, -16), default); 433_ = Unsafe.ReadUnaligned<byte>(ref dest); 461Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, offset), vector); 462Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, offset + (nuint)Vector<byte>.Count), vector); 474Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, offset), vector); 483Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, len - (nuint)Vector<byte>.Count), vector); 501Unsafe.Add(ref dest, (nint)i + 0) = value; 502Unsafe.Add(ref dest, (nint)i + 1) = value; 503Unsafe.Add(ref dest, (nint)i + 2) = value; 504Unsafe.Add(ref dest, (nint)i + 3) = value; 505Unsafe.Add(ref dest, (nint)i + 4) = value; 506Unsafe.Add(ref dest, (nint)i + 5) = value; 507Unsafe.Add(ref dest, (nint)i + 6) = value; 508Unsafe.Add(ref dest, (nint)i + 7) = value; 515Unsafe.Add(ref dest, (nint)i + 0) = value; 516Unsafe.Add(ref dest, (nint)i + 1) = value; 517Unsafe.Add(ref dest, (nint)i + 2) = value; 518Unsafe.Add(ref dest, (nint)i + 3) = value; 525Unsafe.Add(ref dest, (nint)i + 0) = value; 526Unsafe.Add(ref dest, (nint)i + 1) = value; 533Unsafe.Add(ref dest, (nint)i) = value;
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Char.cs (75)
37ref byte valueTail = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref value, 1)); 44int relativeIndex = NonPackedIndexOfChar(ref Unsafe.Add(ref searchSpace, offset), valueHead, remainingSearchSpaceLength); 56ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + 1)), 75ushort ch2Val = Unsafe.Add(ref value, valueTailLength); 78ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 122ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 123ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 142ushort ch2Val = Unsafe.Add(ref value, valueTailLength); 145ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 187ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 188ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 204ushort ch2Val = Unsafe.Add(ref value, valueTailLength); 207ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 249ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 250ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 274return LastIndexOfValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)value, searchSpaceLength); // for single-char values use plain LastIndexOf 284ref byte valueTail = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref value, 1)); 294int relativeIndex = LastIndexOfValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)valueHead, remainingSearchSpaceLength); 300ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, relativeIndex + 1)), 319char ch2Val = Unsafe.Add(ref value, valueTailLength); 322ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 346ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 347ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 369char ch2Val = Unsafe.Add(ref value, valueTailLength); 372ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 396ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 397ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 419char ch2Val = Unsafe.Add(ref value, valueTailLength); 422ch2Val = Unsafe.Add(ref value, --ch1ch2Distance); 446ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 447ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 472if (Unsafe.AreSame(ref first, ref second)) 485if (Unsafe.ReadUnaligned<Vector<ushort>>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, (nint)i))) != 486Unsafe.ReadUnaligned<Vector<ushort>>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, (nint)i)))) 497if (Unsafe.ReadUnaligned<nuint>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, (nint)i))) != 498Unsafe.ReadUnaligned<nuint>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, (nint)i)))) 509if (Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, (nint)i))) == 510Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, (nint)i)))) 519int result = Unsafe.Add(ref first, (nint)i).CompareTo(Unsafe.Add(ref second, (nint)i)); 899ref ushort first = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, offset)); 900ref ushort last = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, lastOffset)); 938ref byte first = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref buf, offset)); 939ref byte last = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref buf, lastOffset)); 977ref ushort first = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, offset)); 978ref ushort last = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, lastOffset)); 1008ReverseInner(ref Unsafe.Add(ref buf, offset), (nuint)remainder);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.cs (37)
17Debug.Assert(Unsafe.IsOpportunisticallyAligned(ref ip, (uint)sizeof(IntPtr)), "Should've been aligned on natural word boundary."); 25Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -1) = default; 26Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -2) = default; 27Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -3) = default; 28Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -4) = default; 29Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -5) = default; 30Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -6) = default; 31Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -7) = default; 32Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -8) = default; 71Unsafe.Add(ref ip, 2) = default; 72Unsafe.Add(ref ip, 3) = default; 73Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -3) = default; 74Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -2) = default; 80Unsafe.Add(ref ip, 1) = default; 81Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -1) = default; 191ReverseInner(ref Unsafe.Add(ref buf, offset), (nuint)remainder); 296ReverseInner(ref Unsafe.Add(ref buf, offset), (nuint)remainder); 309Reverse(ref Unsafe.As<T, byte>(ref elements), length); 314Reverse(ref Unsafe.As<T, char>(ref elements), length); 319Reverse(ref Unsafe.As<T, int>(ref elements), length); 324Reverse(ref Unsafe.As<T, long>(ref elements), length); 338ref T last = ref Unsafe.Subtract(ref Unsafe.Add(ref first, length), 1); 344first = ref Unsafe.Add(ref first, 1); 345last = ref Unsafe.Subtract(ref last, 1); 346} while (Unsafe.IsAddressLessThan(ref first, ref last));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Packed.cs (111)
30return Unsafe.BitCast<T, ushort>(value) - 1u < 254u; 36IndexOf<SpanHelpers.DontNegate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 41IndexOf<SpanHelpers.Negate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 46IndexOfAny<SpanHelpers.DontNegate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 51IndexOfAny<SpanHelpers.Negate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 56IndexOfAny<SpanHelpers.DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, (short)value2, length); 61IndexOfAny<SpanHelpers.Negate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, (short)value2, length); 69return IndexOf<SpanHelpers.DontNegate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 78return IndexOf<SpanHelpers.Negate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 88return IndexOfAny<SpanHelpers.DontNegate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 98return IndexOfAny<SpanHelpers.Negate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 104IndexOfAnyInRange<SpanHelpers.DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)lowInclusive, (short)rangeInclusive, length); 109IndexOfAnyInRange<SpanHelpers.Negate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)lowInclusive, (short)rangeInclusive, length); 125Unsafe.Add(ref searchSpace, 1) == value || 126Unsafe.Add(ref searchSpace, 2) == value || 127Unsafe.Add(ref searchSpace, 3) == value) 139if (Unsafe.Add(ref searchSpace, offset) == value) 162ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count)); 175currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count); 177while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 183ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count); 185ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 211ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count)); 225currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count); 227while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 233ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count); 235ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 269ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count)); 283currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count); 285while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 291ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count); 293ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 329if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, 1)) == value)) return 1; 330if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, 2)) == value)) return 2; 331if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, 3)) == value)) return 3; 340if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset)) == value)) return (int)offset; 361ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count)); 374currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count); 376while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 382ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count); 384ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 410ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count)); 425currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count); 427while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 433ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count); 435ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 470ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count)); 485currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count); 487while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 493ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count); 495ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 535lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, 1)); 537lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, 2)); 539lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, 3)); 549lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset)); 571ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count)); 585currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count); 587while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 593ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count); 595ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 623ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count)); 638currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count); 640while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 646ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count); 648ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 684ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count)); 699currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count); 701while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 707ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count); 709ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 749lookUp = Unsafe.Add(ref searchSpace, 1); 751lookUp = Unsafe.Add(ref searchSpace, 2); 753lookUp = Unsafe.Add(ref searchSpace, 3); 763lookUp = Unsafe.Add(ref searchSpace, offset); 787ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count)); 801currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count); 803while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 809ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count); 811ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 840ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count)); 855currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count); 857while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 863ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count); 865ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 902ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count)); 917currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count); 919while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 925ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count); 927ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 962uint current = (uint)Unsafe.Add(ref searchSpace, i); 986ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count)); 999currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count); 1001while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 1007ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count); 1009ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 1036ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count)); 1051currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count); 1053while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 1059ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count); 1061ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 1097ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count)); 1112currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count); 1114while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd)); 1120ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count); 1122ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd) 1236return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / sizeof(short)); 1245return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / sizeof(short)); 1254return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / sizeof(short)); 1268return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / sizeof(short)); 1283return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / sizeof(short)); 1298return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / sizeof(short));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (418)
39vector = new Vector<byte>(Unsafe.As<T, byte>(ref tmp)); 43vector = (Vector<byte>)(new Vector<ushort>(Unsafe.As<T, ushort>(ref tmp))); 50: (Vector<byte>)(new Vector<uint>(Unsafe.As<T, uint>(ref tmp))); 57: (Vector<byte>)(new Vector<ulong>(Unsafe.As<T, ulong>(ref tmp))); 61Vector128<byte> vec128 = Unsafe.As<T, Vector128<byte>>(ref tmp); 80vector = Unsafe.As<T, Vector256<byte>>(ref tmp).AsVector(); 94ref byte refDataAsBytes = ref Unsafe.As<T, byte>(ref refData); 107Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref refDataAsBytes, offset), vector); 108Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref refDataAsBytes, offset + (nuint)Vector<byte>.Count), vector); 121Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref refDataAsBytes, offset), vector); 131Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref refDataAsBytes, totalByteLength - (nuint)Vector<byte>.Count), vector); 152Unsafe.Add(ref refData, (nint)i + 0) = value; 153Unsafe.Add(ref refData, (nint)i + 1) = value; 154Unsafe.Add(ref refData, (nint)i + 2) = value; 155Unsafe.Add(ref refData, (nint)i + 3) = value; 156Unsafe.Add(ref refData, (nint)i + 4) = value; 157Unsafe.Add(ref refData, (nint)i + 5) = value; 158Unsafe.Add(ref refData, (nint)i + 6) = value; 159Unsafe.Add(ref refData, (nint)i + 7) = value; 167Unsafe.Add(ref refData, (nint)i + 0) = value; 168Unsafe.Add(ref refData, (nint)i + 1) = value; 169Unsafe.Add(ref refData, (nint)i + 2) = value; 170Unsafe.Add(ref refData, (nint)i + 3) = value; 178Unsafe.Add(ref refData, (nint)i + 0) = value; 179Unsafe.Add(ref refData, (nint)i + 1) = value; 187Unsafe.Add(ref refData, (nint)i) = value; 200ref T valueTail = ref Unsafe.Add(ref value, 1); 212int relativeIndex = IndexOf(ref Unsafe.Add(ref searchSpace, index), valueHead, remainingSearchSpaceLength); 218if (SequenceEqual(ref Unsafe.Add(ref searchSpace, index + 1), ref valueTail, valueTailLength)) 241if (value.Equals(Unsafe.Add(ref searchSpace, index + 0)) || 242value.Equals(Unsafe.Add(ref searchSpace, index + 1)) || 243value.Equals(Unsafe.Add(ref searchSpace, index + 2)) || 244value.Equals(Unsafe.Add(ref searchSpace, index + 3)) || 245value.Equals(Unsafe.Add(ref searchSpace, index + 4)) || 246value.Equals(Unsafe.Add(ref searchSpace, index + 5)) || 247value.Equals(Unsafe.Add(ref searchSpace, index + 6)) || 248value.Equals(Unsafe.Add(ref searchSpace, index + 7))) 260if (value.Equals(Unsafe.Add(ref searchSpace, index + 0)) || 261value.Equals(Unsafe.Add(ref searchSpace, index + 1)) || 262value.Equals(Unsafe.Add(ref searchSpace, index + 2)) || 263value.Equals(Unsafe.Add(ref searchSpace, index + 3))) 275if (value.Equals(Unsafe.Add(ref searchSpace, index))) 286if ((object?)Unsafe.Add(ref searchSpace, index) is null) 312if (value.Equals(Unsafe.Add(ref searchSpace, index))) 314if (value.Equals(Unsafe.Add(ref searchSpace, index + 1))) 316if (value.Equals(Unsafe.Add(ref searchSpace, index + 2))) 318if (value.Equals(Unsafe.Add(ref searchSpace, index + 3))) 320if (value.Equals(Unsafe.Add(ref searchSpace, index + 4))) 322if (value.Equals(Unsafe.Add(ref searchSpace, index + 5))) 324if (value.Equals(Unsafe.Add(ref searchSpace, index + 6))) 326if (value.Equals(Unsafe.Add(ref searchSpace, index + 7))) 336if (value.Equals(Unsafe.Add(ref searchSpace, index))) 338if (value.Equals(Unsafe.Add(ref searchSpace, index + 1))) 340if (value.Equals(Unsafe.Add(ref searchSpace, index + 2))) 342if (value.Equals(Unsafe.Add(ref searchSpace, index + 3))) 350if (value.Equals(Unsafe.Add(ref searchSpace, index))) 362if ((object?)Unsafe.Add(ref searchSpace, index) is null) 400lookUp = Unsafe.Add(ref searchSpace, index); 403lookUp = Unsafe.Add(ref searchSpace, index + 1); 406lookUp = Unsafe.Add(ref searchSpace, index + 2); 409lookUp = Unsafe.Add(ref searchSpace, index + 3); 412lookUp = Unsafe.Add(ref searchSpace, index + 4); 415lookUp = Unsafe.Add(ref searchSpace, index + 5); 418lookUp = Unsafe.Add(ref searchSpace, index + 6); 421lookUp = Unsafe.Add(ref searchSpace, index + 7); 430lookUp = Unsafe.Add(ref searchSpace, index); 433lookUp = Unsafe.Add(ref searchSpace, index + 1); 436lookUp = Unsafe.Add(ref searchSpace, index + 2); 439lookUp = Unsafe.Add(ref searchSpace, index + 3); 448lookUp = Unsafe.Add(ref searchSpace, index); 459lookUp = Unsafe.Add(ref searchSpace, index); 506lookUp = Unsafe.Add(ref searchSpace, index); 509lookUp = Unsafe.Add(ref searchSpace, index + 1); 512lookUp = Unsafe.Add(ref searchSpace, index + 2); 515lookUp = Unsafe.Add(ref searchSpace, index + 3); 518lookUp = Unsafe.Add(ref searchSpace, index + 4); 521lookUp = Unsafe.Add(ref searchSpace, index + 5); 524lookUp = Unsafe.Add(ref searchSpace, index + 6); 527lookUp = Unsafe.Add(ref searchSpace, index + 7); 536lookUp = Unsafe.Add(ref searchSpace, index); 539lookUp = Unsafe.Add(ref searchSpace, index + 1); 542lookUp = Unsafe.Add(ref searchSpace, index + 2); 545lookUp = Unsafe.Add(ref searchSpace, index + 3); 554lookUp = Unsafe.Add(ref searchSpace, index); 565lookUp = Unsafe.Add(ref searchSpace, index); 626T candidate = Unsafe.Add(ref searchSpace, i); 629if (Unsafe.Add(ref value, j)!.Equals(candidate)) 643T candidate = Unsafe.Add(ref searchSpace, i); 648if (candidate.Equals(Unsafe.Add(ref value, j))) 658if (Unsafe.Add(ref value, j) is null) 687ref T valueTail = ref Unsafe.Add(ref value, 1); 702if (SequenceEqual(ref Unsafe.Add(ref searchSpace, relativeIndex + 1), ref valueTail, valueTailLength)) 722if (value.Equals(Unsafe.Add(ref searchSpace, length + 7))) 724if (value.Equals(Unsafe.Add(ref searchSpace, length + 6))) 726if (value.Equals(Unsafe.Add(ref searchSpace, length + 5))) 728if (value.Equals(Unsafe.Add(ref searchSpace, length + 4))) 730if (value.Equals(Unsafe.Add(ref searchSpace, length + 3))) 732if (value.Equals(Unsafe.Add(ref searchSpace, length + 2))) 734if (value.Equals(Unsafe.Add(ref searchSpace, length + 1))) 736if (value.Equals(Unsafe.Add(ref searchSpace, length))) 744if (value.Equals(Unsafe.Add(ref searchSpace, length + 3))) 746if (value.Equals(Unsafe.Add(ref searchSpace, length + 2))) 748if (value.Equals(Unsafe.Add(ref searchSpace, length + 1))) 750if (value.Equals(Unsafe.Add(ref searchSpace, length))) 758if (value.Equals(Unsafe.Add(ref searchSpace, length))) 766if ((object?)Unsafe.Add(ref searchSpace, length) is null) 806lookUp = Unsafe.Add(ref searchSpace, length + 7); 809lookUp = Unsafe.Add(ref searchSpace, length + 6); 812lookUp = Unsafe.Add(ref searchSpace, length + 5); 815lookUp = Unsafe.Add(ref searchSpace, length + 4); 818lookUp = Unsafe.Add(ref searchSpace, length + 3); 821lookUp = Unsafe.Add(ref searchSpace, length + 2); 824lookUp = Unsafe.Add(ref searchSpace, length + 1); 827lookUp = Unsafe.Add(ref searchSpace, length); 836lookUp = Unsafe.Add(ref searchSpace, length + 3); 839lookUp = Unsafe.Add(ref searchSpace, length + 2); 842lookUp = Unsafe.Add(ref searchSpace, length + 1); 845lookUp = Unsafe.Add(ref searchSpace, length); 854lookUp = Unsafe.Add(ref searchSpace, length); 863lookUp = Unsafe.Add(ref searchSpace, length); 911lookUp = Unsafe.Add(ref searchSpace, length + 7); 914lookUp = Unsafe.Add(ref searchSpace, length + 6); 917lookUp = Unsafe.Add(ref searchSpace, length + 5); 920lookUp = Unsafe.Add(ref searchSpace, length + 4); 923lookUp = Unsafe.Add(ref searchSpace, length + 3); 926lookUp = Unsafe.Add(ref searchSpace, length + 2); 929lookUp = Unsafe.Add(ref searchSpace, length + 1); 932lookUp = Unsafe.Add(ref searchSpace, length); 941lookUp = Unsafe.Add(ref searchSpace, length + 3); 944lookUp = Unsafe.Add(ref searchSpace, length + 2); 947lookUp = Unsafe.Add(ref searchSpace, length + 1); 950lookUp = Unsafe.Add(ref searchSpace, length); 959lookUp = Unsafe.Add(ref searchSpace, length); 968lookUp = Unsafe.Add(ref searchSpace, length); 1018T candidate = Unsafe.Add(ref searchSpace, i); 1021if (Unsafe.Add(ref value, j)!.Equals(candidate)) 1032T candidate = Unsafe.Add(ref searchSpace, i); 1037if (candidate.Equals(Unsafe.Add(ref value, j))) 1047if (Unsafe.Add(ref value, j) is null) 1065if (!EqualityComparer<T>.Default.Equals(Unsafe.Add(ref searchSpace, i), value0)) 1080if (!EqualityComparer<T>.Default.Equals(Unsafe.Add(ref searchSpace, i), value0)) 1095ref T current = ref Unsafe.Add(ref searchSpace, i); 1111ref T current = ref Unsafe.Add(ref searchSpace, i); 1127ref T current = ref Unsafe.Add(ref searchSpace, i); 1145ref T current = ref Unsafe.Add(ref searchSpace, i); 1163ref T current = ref Unsafe.Add(ref searchSpace, i); 1182ref T current = ref Unsafe.Add(ref searchSpace, i); 1199if (Unsafe.AreSame(ref first, ref second)) 1209lookUp0 = Unsafe.Add(ref first, index); 1210lookUp1 = Unsafe.Add(ref second, index); 1213lookUp0 = Unsafe.Add(ref first, index + 1); 1214lookUp1 = Unsafe.Add(ref second, index + 1); 1217lookUp0 = Unsafe.Add(ref first, index + 2); 1218lookUp1 = Unsafe.Add(ref second, index + 2); 1221lookUp0 = Unsafe.Add(ref first, index + 3); 1222lookUp1 = Unsafe.Add(ref second, index + 3); 1225lookUp0 = Unsafe.Add(ref first, index + 4); 1226lookUp1 = Unsafe.Add(ref second, index + 4); 1229lookUp0 = Unsafe.Add(ref first, index + 5); 1230lookUp1 = Unsafe.Add(ref second, index + 5); 1233lookUp0 = Unsafe.Add(ref first, index + 6); 1234lookUp1 = Unsafe.Add(ref second, index + 6); 1237lookUp0 = Unsafe.Add(ref first, index + 7); 1238lookUp1 = Unsafe.Add(ref second, index + 7); 1249lookUp0 = Unsafe.Add(ref first, index); 1250lookUp1 = Unsafe.Add(ref second, index); 1253lookUp0 = Unsafe.Add(ref first, index + 1); 1254lookUp1 = Unsafe.Add(ref second, index + 1); 1257lookUp0 = Unsafe.Add(ref first, index + 2); 1258lookUp1 = Unsafe.Add(ref second, index + 2); 1261lookUp0 = Unsafe.Add(ref first, index + 3); 1262lookUp1 = Unsafe.Add(ref second, index + 3); 1271lookUp0 = Unsafe.Add(ref first, index); 1272lookUp1 = Unsafe.Add(ref second, index); 1297T lookUp = Unsafe.Add(ref second, i); 1298int result = (Unsafe.Add(ref first, i)?.CompareTo(lookUp) ?? (((object?)lookUp is null) ? 0 : -1)); 1310return PackedSpanHelpers.Contains(ref Unsafe.As<T, short>(ref searchSpace), Unsafe.BitCast<T, short>(value), length); 1329if (Unsafe.Add(ref searchSpace, offset) == value 1330|| Unsafe.Add(ref searchSpace, offset + 1) == value 1331|| Unsafe.Add(ref searchSpace, offset + 2) == value 1332|| Unsafe.Add(ref searchSpace, offset + 3) == value 1333|| Unsafe.Add(ref searchSpace, offset + 4) == value 1334|| Unsafe.Add(ref searchSpace, offset + 5) == value 1335|| Unsafe.Add(ref searchSpace, offset + 6) == value 1336|| Unsafe.Add(ref searchSpace, offset + 7) == value) 1348if (Unsafe.Add(ref searchSpace, offset) == value 1349|| Unsafe.Add(ref searchSpace, offset + 1) == value 1350|| Unsafe.Add(ref searchSpace, offset + 2) == value 1351|| Unsafe.Add(ref searchSpace, offset + 3) == value) 1363if (Unsafe.Add(ref searchSpace, offset) == value) return true; 1372ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector512<T>.Count)); 1384currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector512<T>.Count); 1386while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1403ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector256<T>.Count)); 1411currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<T>.Count); 1417while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1433ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector128<T>.Count)); 1441currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<T>.Count); 1447while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1465=> IndexOfValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 1469NonPackedIndexOfValueType<short, DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 1487? PackedSpanHelpers.IndexOf(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value), length) 1488: PackedSpanHelpers.IndexOfAnyExcept(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value), length); 1509if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) goto Found; 1510if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 1) == value)) goto Found1; 1511if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 2) == value)) goto Found2; 1512if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 3) == value)) goto Found3; 1513if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 4) == value)) goto Found4; 1514if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 5) == value)) goto Found5; 1515if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 6) == value)) goto Found6; 1516if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 7) == value)) goto Found7; 1525if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) goto Found; 1526if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 1) == value)) goto Found1; 1527if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 2) == value)) goto Found2; 1528if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset + 3) == value)) goto Found3; 1537if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) goto Found; 1563ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<TValue>.Count); 1575currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector512<TValue>.Count); 1577while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1594ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<TValue>.Count); 1602currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<TValue>.Count); 1608while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1624ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<TValue>.Count); 1632currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<TValue>.Count); 1638while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1656=> IndexOfAnyValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 1673char char0 = Unsafe.BitCast<TValue, char>(value0); 1674char char1 = Unsafe.BitCast<TValue, char>(value1); 1686? PackedSpanHelpers.IndexOfAnyIgnoreCase(ref Unsafe.As<TValue, char>(ref searchSpace), lowerCase, length) 1687: PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref Unsafe.As<TValue, char>(ref searchSpace), lowerCase, length); 1692? PackedSpanHelpers.IndexOfAny(ref Unsafe.As<TValue, char>(ref searchSpace), char0, char1, length) 1693: PackedSpanHelpers.IndexOfAnyExcept(ref Unsafe.As<TValue, char>(ref searchSpace), char0, char1, length); 1718ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1721lookUp = Unsafe.Add(ref current, 1); 1723lookUp = Unsafe.Add(ref current, 2); 1725lookUp = Unsafe.Add(ref current, 3); 1727lookUp = Unsafe.Add(ref current, 4); 1729lookUp = Unsafe.Add(ref current, 5); 1731lookUp = Unsafe.Add(ref current, 6); 1733lookUp = Unsafe.Add(ref current, 7); 1744ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1747lookUp = Unsafe.Add(ref current, 1); 1749lookUp = Unsafe.Add(ref current, 2); 1751lookUp = Unsafe.Add(ref current, 3); 1761lookUp = Unsafe.Add(ref searchSpace, offset); 1788ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<TValue>.Count); 1797currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector512<TValue>.Count); 1803while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1820ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<TValue>.Count); 1829currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<TValue>.Count); 1835while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1852ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<TValue>.Count); 1861currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<TValue>.Count); 1867while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 1900? PackedSpanHelpers.IndexOfAny(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value0), Unsafe.BitCast<TValue, char>(value1), Unsafe.BitCast<TValue, char>(value2), length) 1901: PackedSpanHelpers.IndexOfAnyExcept(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value0), Unsafe.BitCast<TValue, char>(value1), Unsafe.BitCast<TValue, char>(value2), length); 1925ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1928lookUp = Unsafe.Add(ref current, 1); 1930lookUp = Unsafe.Add(ref current, 2); 1932lookUp = Unsafe.Add(ref current, 3); 1934lookUp = Unsafe.Add(ref current, 4); 1936lookUp = Unsafe.Add(ref current, 5); 1938lookUp = Unsafe.Add(ref current, 6); 1940lookUp = Unsafe.Add(ref current, 7); 1951ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1954lookUp = Unsafe.Add(ref current, 1); 1956lookUp = Unsafe.Add(ref current, 2); 1958lookUp = Unsafe.Add(ref current, 3); 1968lookUp = Unsafe.Add(ref searchSpace, offset); 1995ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<TValue>.Count); 2004currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector512<TValue>.Count); 2010while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2027ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<TValue>.Count); 2036currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<TValue>.Count); 2042while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2059ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<TValue>.Count); 2068currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<TValue>.Count); 2074while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2115ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2118lookUp = Unsafe.Add(ref current, 1); 2120lookUp = Unsafe.Add(ref current, 2); 2122lookUp = Unsafe.Add(ref current, 3); 2132lookUp = Unsafe.Add(ref searchSpace, offset); 2151ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<TValue>.Count); 2161currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector512<TValue>.Count); 2167while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2185ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<TValue>.Count); 2195currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<TValue>.Count); 2201while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2219ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<TValue>.Count); 2229currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<TValue>.Count); 2235while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2277ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2280lookUp = Unsafe.Add(ref current, 1); 2282lookUp = Unsafe.Add(ref current, 2); 2284lookUp = Unsafe.Add(ref current, 3); 2294lookUp = Unsafe.Add(ref searchSpace, offset); 2315ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector512<TValue>.Count)); 2325currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector512<TValue>.Count); 2331while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2350ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector256<TValue>.Count)); 2360currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<TValue>.Count); 2366while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2385ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector128<TValue>.Count)); 2395currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<TValue>.Count); 2401while (!Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)); 2442if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) goto Found; 2443if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 1) == value)) goto FoundM1; 2444if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 2) == value)) goto FoundM2; 2445if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 3) == value)) goto FoundM3; 2446if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 4) == value)) goto FoundM4; 2447if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 5) == value)) goto FoundM5; 2448if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 6) == value)) goto FoundM6; 2449if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 7) == value)) goto FoundM7; 2458if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) goto Found; 2459if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 1) == value)) goto FoundM1; 2460if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 2) == value)) goto FoundM2; 2461if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset - 3) == value)) goto FoundM3; 2470if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) goto Found; 2565ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2568lookUp = Unsafe.Add(ref current, -1); 2570lookUp = Unsafe.Add(ref current, -2); 2572lookUp = Unsafe.Add(ref current, -3); 2574lookUp = Unsafe.Add(ref current, -4); 2576lookUp = Unsafe.Add(ref current, -5); 2578lookUp = Unsafe.Add(ref current, -6); 2580lookUp = Unsafe.Add(ref current, -7); 2591ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2594lookUp = Unsafe.Add(ref current, -1); 2596lookUp = Unsafe.Add(ref current, -2); 2598lookUp = Unsafe.Add(ref current, -3); 2608lookUp = Unsafe.Add(ref searchSpace, offset); 2750ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2753lookUp = Unsafe.Add(ref current, -1); 2755lookUp = Unsafe.Add(ref current, -2); 2757lookUp = Unsafe.Add(ref current, -3); 2759lookUp = Unsafe.Add(ref current, -4); 2761lookUp = Unsafe.Add(ref current, -5); 2763lookUp = Unsafe.Add(ref current, -6); 2765lookUp = Unsafe.Add(ref current, -7); 2776ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2779lookUp = Unsafe.Add(ref current, -1); 2781lookUp = Unsafe.Add(ref current, -2); 2783lookUp = Unsafe.Add(ref current, -3); 2793lookUp = Unsafe.Add(ref searchSpace, offset); 2934ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2937lookUp = Unsafe.Add(ref current, -1); 2939lookUp = Unsafe.Add(ref current, -2); 2941lookUp = Unsafe.Add(ref current, -3); 2951lookUp = Unsafe.Add(ref searchSpace, offset); 3068T original = Unsafe.Add(ref src, idx); 3069Unsafe.Add(ref dst, idx) = oldValue.Equals(original) ? newValue : original; 3076T original = Unsafe.Add(ref src, idx); 3077Unsafe.Add(ref dst, idx) = original is null ? newValue : original; 3088T original = Unsafe.Add(ref src, idx); 3089Unsafe.Add(ref dst, idx) = EqualityComparer<T>.Default.Equals(original, oldValue) ? newValue : original; 3201ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 3204lookUp = Unsafe.Add(ref current, -1); 3206lookUp = Unsafe.Add(ref current, -2); 3208lookUp = Unsafe.Add(ref current, -3); 3218lookUp = Unsafe.Add(ref searchSpace, offset); 3330return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 3338return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 3346return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T)); 3443ref T current = ref Unsafe.Add(ref searchSpace, i); 3458ref T current = ref Unsafe.Add(ref searchSpace, i); 3483ref char charSearchSpace = ref Unsafe.As<T, char>(ref searchSpace); 3484char charLowInclusive = Unsafe.BitCast<T, char>(lowInclusive); 3485char charRange = (char)(Unsafe.BitCast<T, char>(highInclusive) - charLowInclusive); 3506ref T current = ref Unsafe.Add(ref searchSpace, i); 3520ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector128<T>.Count)); 3531current = ref Unsafe.Add(ref current, Vector128<T>.Count); 3533while (Unsafe.IsAddressLessThan(ref current, ref oneVectorAwayFromEnd)); 3549ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector256<T>.Count)); 3560current = ref Unsafe.Add(ref current, Vector256<T>.Count); 3562while (Unsafe.IsAddressLessThan(ref current, ref oneVectorAwayFromEnd)); 3578ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector512<T>.Count)); 3589current = ref Unsafe.Add(ref current, Vector256<T>.Count); 3591while (Unsafe.IsAddressLessThan(ref current, ref oneVectorAwayFromEnd)); 3609ref T current = ref Unsafe.Add(ref searchSpace, i); 3624ref T current = ref Unsafe.Add(ref searchSpace, i); 3653ref T current = ref Unsafe.Add(ref searchSpace, i); 3749ref T end = ref Unsafe.Add(ref current, length); 3752while (Unsafe.IsAddressLessThan(ref current, ref end)) 3759current = ref Unsafe.Add(ref current, 1); 3764while (Unsafe.IsAddressLessThan(ref current, ref end)) 3771current = ref Unsafe.Add(ref current, 1); 3781ref T end = ref Unsafe.Add(ref current, length); 3788ref T oneVectorAwayFromEnd = ref Unsafe.Subtract(ref end, Vector512<T>.Count); 3792current = ref Unsafe.Add(ref current, Vector512<T>.Count); 3794while (!Unsafe.IsAddressGreaterThan(ref current, ref oneVectorAwayFromEnd)); 3800uint remaining = (uint)Unsafe.ByteOffset(ref current, ref end) / (uint)Unsafe.SizeOf<T>(); 3816ref T oneVectorAwayFromEnd = ref Unsafe.Subtract(ref end, Vector256<T>.Count); 3820current = ref Unsafe.Add(ref current, Vector256<T>.Count); 3822while (!Unsafe.IsAddressGreaterThan(ref current, ref oneVectorAwayFromEnd)); 3828uint remaining = (uint)Unsafe.ByteOffset(ref current, ref end) / (uint)Unsafe.SizeOf<T>(); 3844ref T oneVectorAwayFromEnd = ref Unsafe.Subtract(ref end, Vector128<T>.Count); 3848current = ref Unsafe.Add(ref current, Vector128<T>.Count); 3850while (!Unsafe.IsAddressGreaterThan(ref current, ref oneVectorAwayFromEnd)); 3852uint remaining = (uint)Unsafe.ByteOffset(ref current, ref end) / (uint)Unsafe.SizeOf<T>(); 3867while (Unsafe.IsAddressLessThan(ref current, ref end)) 3874current = ref Unsafe.Add(ref current, 1);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (12)
29ref Unsafe.As<char, byte>(ref strA.GetRawStringData()), 30ref Unsafe.As<char, byte>(ref strB.GetRawStringData()), 44ref Unsafe.Add(ref strA.GetRawStringData(), (nint)(uint)indexA /* force zero-extension */), countA, 45ref Unsafe.Add(ref strB.GetRawStringData(), (nint)(uint)indexB /* force zero-extension */), countB); 420return Ordinal.CompareStringIgnoreCase(ref Unsafe.Add(ref strA.GetRawStringData(), indexA), lengthA, ref Unsafe.Add(ref strB.GetRawStringData(), indexB), lengthB); 569Ordinal.EqualsIgnoreCase(ref Unsafe.Add(ref GetRawStringData(), Length - value.Length), 604return Unsafe.Add(ref _firstChar, (nint)localLength - 1) == value; 757return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref _firstChar), (uint)_stringLength * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)); 778return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)); 986ref Unsafe.As<char, byte>(ref this.GetRawStringData()), 987ref Unsafe.As<char, byte>(ref value.GetRawStringData()),
src\libraries\System.Private.CoreLib\src\System\String.cs (8)
113source: ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(value), startIndex)); 382slice = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, (nint)(uint)startIndex /* force zero-extension */), count); 423destination: ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(destination), destinationIndex), 424source: ref Unsafe.Add(ref _firstChar, sourceIndex), 493source: ref Unsafe.Add(ref _firstChar, startIndex), 524internal ref ushort GetRawStringDataAsUInt16() => ref Unsafe.As<char, ushort>(ref _firstChar); 568Unsafe.Add(ref result._firstChar, 1) = c2; 748return Unsafe.Add(ref _firstChar, (nint)(uint)index /* force zero-extension */);
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (25)
48destination: ref Unsafe.Add(ref dest._firstChar, destPos), 698Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref value._firstChar, (nuint)insertLength); 699Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex + insertLength), ref Unsafe.Add(ref _firstChar, startIndex), (nuint)(oldLength - startIndex)); 912return JoinCore(separator, CollectionsMarshal.AsSpan(Unsafe.As<List<string?>>(values))); 935IEnumerator<char> en = Unsafe.As<IEnumerator<char>>(e); 1086ref char dest = ref Unsafe.Add(ref result._firstChar, copiedLength); 1123Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, count), ref _firstChar, (nuint)oldLength); 1141new Span<char>(ref Unsafe.Add(ref result._firstChar, oldLength), count).Fill(paddingChar); 1162Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref Unsafe.Add(ref _firstChar, startIndex + count), (nuint)(newLength - startIndex)); 1291ref ushort pSrc = ref Unsafe.Add(ref GetRawStringDataAsUInt16(), (uint)copyLength); 1292ref ushort pDst = ref Unsafe.Add(ref result.GetRawStringDataAsUInt16(), (uint)copyLength); 1301pSrc = ref Unsafe.Subtract(ref pSrc, adjust); 1302pDst = ref Unsafe.Subtract(ref pDst, adjust); 1308pSrc = ref Unsafe.Subtract(ref pSrc, adjust); 1309pDst = ref Unsafe.Subtract(ref pDst, adjust); 1315pSrc = ref Unsafe.Subtract(ref pSrc, adjust); 1316pDst = ref Unsafe.Subtract(ref pDst, adjust); 1355int pos = PackedSpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1368int pos = SpanHelpers.NonPackedIndexOfChar(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1384int pos = SpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), Length - i, ref oldValue._firstChar, oldValue.Length); 2018ref uint charMap = ref Unsafe.As<ProbabilisticMap, uint>(ref map); 2134char curr = Unsafe.Add(ref source, offset); 2290source: ref Unsafe.Add(ref _firstChar, (nint)(uint)startIndex /* force zero-extension */));
src\libraries\System.Private.CoreLib\src\System\String.Searching.cs (7)
37=> SpanHelpers.ContainsValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 109int result = SpanHelpers.IndexOfChar(ref Unsafe.Add(ref _firstChar, startIndex), value, count); 149int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startIndex), count).IndexOfAny(anyOf); 294=> SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 319int result = SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref Unsafe.Add(ref _firstChar, startSearchAt)), (short)value, count); 367int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startSearchAt), count).LastIndexOfAny(anyOf);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.CaseConversion.cs (7)
318ulong nextBlockAsUInt64 = Unsafe.ReadUnaligned<ulong>(&pSrc[i]); 342Unsafe.WriteUnaligned(&pDest[i], nextBlockAsUInt64); 357Unsafe.WriteUnaligned(&pDest[i], narrowedBlock.ToScalar()); 377uint nextBlockAsUInt32 = Unsafe.ReadUnaligned<uint>(&pSrc[i]); 401Unsafe.WriteUnaligned(&pDest[i], nextBlockAsUInt32); 411Unsafe.WriteUnaligned(&pDest[i], widenedBlock.ToScalar()); 417Unsafe.WriteUnaligned(&pDest[i], narrowedBlock.ToScalar());
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.cs (36)
32IsValidCore(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(value)), value.Length); 62Unsafe.ReadUnaligned<uint>(ref Unsafe.As<T, byte>(ref searchSpace)) | 63Unsafe.ReadUnaligned<uint>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, length - sizeof(uint))))); 70? (Unsafe.BitCast<T, byte>(Unsafe.Add(ref searchSpace, j)) > 127) 71: (Unsafe.BitCast<T, char>(Unsafe.Add(ref searchSpace, j)) > 127)) 90Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, i))) | 91Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, i + elementsPerUlong))))) 102Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, i))) | 103Unsafe.ReadUnaligned<ulong>(ref Unsafe.Subtract(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, length)), sizeof(ulong)))); 106ref T searchSpaceEnd = ref Unsafe.Add(ref searchSpace, length); 113Vector128.LoadUnsafe(ref Unsafe.Subtract(ref searchSpaceEnd, Vector128<T>.Count))); 123Vector256.LoadUnsafe(ref Unsafe.Subtract(ref searchSpaceEnd, Vector256<T>.Count))); 144nuint misalignedElements = Unsafe.OpportunisticMisalignment(ref searchSpace, (uint)Vector256<byte>.Count) / (nuint)sizeof(T); 152ref T current = ref Unsafe.Add(ref searchSpace, i); 164searchSpace = ref Unsafe.Add(ref searchSpace, finalStart); 173Vector256.LoadUnsafe(ref Unsafe.Subtract(ref searchSpaceEnd, 2 * Vector256<T>.Count)) | 174Vector256.LoadUnsafe(ref Unsafe.Subtract(ref searchSpaceEnd, Vector256<T>.Count))); 196nuint misalignedElements = Unsafe.OpportunisticMisalignment(ref searchSpace, (uint)Vector128<byte>.Count) / (nuint)sizeof(T); 204ref T current = ref Unsafe.Add(ref searchSpace, i); 216searchSpace = ref Unsafe.Add(ref searchSpace, finalStart); 225Vector128.LoadUnsafe(ref Unsafe.Subtract(ref searchSpaceEnd, 2 * Vector128<T>.Count)) | 226Vector128.LoadUnsafe(ref Unsafe.Subtract(ref searchSpaceEnd, Vector128<T>.Count)));
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Equality.cs (43)
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); 55uint valueA = uint.CreateTruncating(Unsafe.Add(ref left, i)); 56uint valueB = uint.CreateTruncating(Unsafe.Add(ref right, i)); 72ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector512<TLeft>.Count); 82currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, Vector512<TLeft>.Count); 83currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, Vector512<TLeft>.Count); 85while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd)); 90ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector512<TLeft>.Count); 102ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector256<TLeft>.Count); 112currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, Vector256<TLeft>.Count); 113currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, Vector256<TLeft>.Count); 115while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd)); 120ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector256<TLeft>.Count); 127ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count128); 129ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector128<TRight>.Count); 146currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector128<TRight>.Count); 147currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count128); 149while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd)); 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); 193EqualsIgnoreCase<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref left), ref Unsafe.As<char, ushort>(ref right), length); 209uint valueA = uint.CreateTruncating(Unsafe.Add(ref left, i)); 210uint valueB = uint.CreateTruncating(Unsafe.Add(ref right, i)); 237ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count512); 239ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector512<TRight>.Count); 273currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector512<TRight>.Count); 274currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count512); 276while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd)); 308ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count256); 310ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector256<TRight>.Count); 345currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector256<TRight>.Count); 346currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count256); 348while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd)); 380ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count128); 382ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector128<TRight>.Count); 418currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector128<TRight>.Count); 419currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count128); 421while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd)); 522Vector128<byte> vec = Vector128.CreateScalarUnsafe(Unsafe.ReadUnaligned<long>(ref ptr)).AsByte();
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.cs (45)
252currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer); 253uint nextUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer + 4); 277currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer); 290currentUInt32 = Unsafe.ReadUnaligned<ushort>(pBuffer); 621ulong candidateUInt64 = Unsafe.ReadUnaligned<ulong>(pBuffer); 636currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer); 637uint nextDWord = Unsafe.ReadUnaligned<uint>(pBuffer + 4); 661currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer); 676currentDWord = Unsafe.ReadUnaligned<ushort>(pBuffer); 866currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer); 867uint nextUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer + 4 / sizeof(char)); 891currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer); 1172ulong candidateUInt64 = Unsafe.ReadUnaligned<ulong>(pBuffer); 1189currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer); 1190uint nextDWord = Unsafe.ReadUnaligned<uint>(pBuffer + 4 / sizeof(char)); 1214currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer); 1255Unsafe.WriteUnaligned(ref outputBuffer, Sse2.ConvertToUInt32(vecNarrow)); 1264Unsafe.WriteUnaligned(ref outputBuffer, lower.AsUInt32().ToScalar()); 1273Unsafe.Add(ref outputBuffer, 1) = (byte)value; 1275Unsafe.Add(ref outputBuffer, 2) = (byte)value; 1277Unsafe.Add(ref outputBuffer, 3) = (byte)value; 1281Unsafe.Add(ref outputBuffer, 3) = (byte)value; 1283Unsafe.Add(ref outputBuffer, 2) = (byte)value; 1285Unsafe.Add(ref outputBuffer, 1) = (byte)value; 1305Unsafe.Add(ref outputBuffer, 1) = (byte)(value >> 16); 1309Unsafe.Add(ref outputBuffer, 1) = (byte)value; 1335utf16Data64Bits = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer); 1343utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer); 1344utf16Data32BitsLow = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + 4 / sizeof(char)); 1378utf16Data64Bits = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer + currentOffset); 1388utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset); 1389utf16Data32BitsLow = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset + 4 / sizeof(char)); 1407utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset); 2068asciiData = Unsafe.ReadUnaligned<uint>(pAsciiBuffer + currentOffset); 2083asciiData = Unsafe.ReadUnaligned<ushort>(pAsciiBuffer + currentOffset); 2245Unsafe.WriteUnaligned(ref Unsafe.As<char, byte>(ref outputBuffer), vecWide.ToScalar()); 2251Unsafe.WriteUnaligned(ref Unsafe.As<char, byte>(ref outputBuffer), vecWide.ToScalar()); 2259Unsafe.Add(ref outputBuffer, 1) = (char)(byte)value; 2261Unsafe.Add(ref outputBuffer, 2) = (char)(byte)value; 2263Unsafe.Add(ref outputBuffer, 3) = (char)value; 2267Unsafe.Add(ref outputBuffer, 3) = (char)(byte)value; 2269Unsafe.Add(ref outputBuffer, 2) = (char)(byte)value; 2271Unsafe.Add(ref outputBuffer, 1) = (char)(byte)value;
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (12)
272pChars: (char*)Unsafe.AsPointer(ref 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)), 652pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)), 654pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 872pBytes: (byte*)Unsafe.AsPointer(ref 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)), 1252pBytes: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytes)), 1254pChars: (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(chars)),
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Utility.cs (25)
52if (Vector.LessThanOrEqualAll(Unsafe.ReadUnaligned<Vector<ushort>>(pBuffer), maxLatin1)) 72if (Vector.GreaterThanAny(Unsafe.Read<Vector<ushort>>(pBuffer), maxLatin1)) 98currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer); 99uint nextUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer + 4 / sizeof(char)); 123currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer); 463ulong candidateUInt64 = Unsafe.ReadUnaligned<ulong>(pBuffer); 480currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer); 481uint nextDWord = Unsafe.ReadUnaligned<uint>(pBuffer + 4 / sizeof(char)); 505currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer); 560utf16Data64Bits = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer); 568utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer); 569utf16Data32BitsLow = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + 4 / sizeof(char)); 592utf16Data64Bits = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer); 600utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer); 601utf16Data32BitsLow = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + 4 / sizeof(char)); 613Vector<ushort> utf16VectorHigh = Unsafe.ReadUnaligned<Vector<ushort>>(pUtf16Buffer + currentOffset); 614Vector<ushort> utf16VectorLow = Unsafe.ReadUnaligned<Vector<ushort>>(pUtf16Buffer + currentOffset + Vector<ushort>.Count); 623Unsafe.WriteUnaligned(pLatin1Buffer + currentOffset, latin1Vector); 644utf16Data64Bits = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer + currentOffset); 654utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset); 655utf16Data32BitsLow = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset + 4 / sizeof(char)); 673utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset); 1087Vector<byte> latin1Vector = Unsafe.ReadUnaligned<Vector<byte>>(pLatin1Buffer + currentOffset); 1091Unsafe.WriteUnaligned(pUtf16Buffer + currentOffset, utf16LowVector); 1092Unsafe.WriteUnaligned(pUtf16Buffer + currentOffset + Vector<ushort>.Count, utf16HighVector);
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Utility.Helpers.cs (9)
60Unsafe.WriteUnaligned(ref outputBuffer, Sse2.ConvertToUInt32(vecNarrow)); 68Unsafe.Add(ref outputBuffer, 1) = (byte)value; 70Unsafe.Add(ref outputBuffer, 2) = (byte)value; 72Unsafe.Add(ref outputBuffer, 3) = (byte)value; 76Unsafe.Add(ref outputBuffer, 3) = (byte)value; 78Unsafe.Add(ref outputBuffer, 2) = (byte)value; 80Unsafe.Add(ref outputBuffer, 1) = (byte)value; 100Unsafe.Add(ref outputBuffer, 1) = (byte)(value >> 16); 104Unsafe.Add(ref outputBuffer, 1) = (byte)value;
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (8)
340ref Unsafe.Add(ref result.GetRawStringData(), chunkOffset), 787Append(ref Unsafe.Add(ref value.GetRawStringData(), startIndex), count); 1237Debug.Assert(!Unsafe.IsNullRef(ref separator)); 2276ref char destination = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(chunkChars), chunkLength); 2282Unsafe.Add(ref destination, 1) = Unsafe.Add(ref value, 1); 2323new ReadOnlySpan<char>(ref Unsafe.Add(ref value, firstLength), restLength).CopyTo(m_ChunkChars); 2490value = ref Unsafe.Add(ref value, lengthToCopy);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf16Utility.Validation.cs (1)
417thisChar = Unsafe.ReadUnaligned<uint>(pInputBuffer);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (18)
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)); 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)); 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));
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.cs (1)
31int index = (int)(void*)Unsafe.ByteOffset(ref *pUtf8Data, ref *pFirstInvalidByte);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Helpers.cs (12)
736Unsafe.WriteUnaligned(ref outputBuffer, tempA + tempB + 0xE080_80E0u); // = [ 1110ZZZZ 10xxxxxx 10yyyyyy 1110zzzz ] 737Unsafe.WriteUnaligned(ref Unsafe.Add(ref outputBuffer, 4), (ushort)(((value >> 22) & 0x3Fu) + ((value >> 8) & 0x3F00u) + 0x8080u)); // = [ 10XXXXXX 10YYYYYY ] 744Unsafe.Add(ref outputBuffer, 5) = (byte)((value & 0x3Fu) | 0x80u); 745Unsafe.Add(ref outputBuffer, 4) = (byte)(((value >>= 6) & 0x3Fu) | 0x80u); 746Unsafe.Add(ref outputBuffer, 3) = (byte)(((value >>= 6) & 0x0Fu) | 0xE0u); 747Unsafe.Add(ref outputBuffer, 2) = (byte)(((value >>= 4) & 0x3Fu) | 0x80u); 748Unsafe.Add(ref outputBuffer, 1) = (byte)(((value >>= 6) & 0x3Fu) | 0x80u); 770Unsafe.WriteUnaligned(ref outputBuffer, (ushort)(tempA + tempB + 0x80E0u)); // [ 10yyyyyy 1110zzzz ] 771Unsafe.Add(ref outputBuffer, 2) = (byte)((value & 0x3Fu) | ~0x7Fu); // [ 10xxxxxx ] 778Unsafe.Add(ref outputBuffer, 2) = (byte)(((value >>= 16) & 0x3Fu) | 0x80u); 779Unsafe.Add(ref outputBuffer, 1) = (byte)(((value >>= 6) & 0x3Fu) | 0x80u);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Transcoding.cs (36)
67uint thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 94uint remainingInputBytes = (uint)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) + 4; 102thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 103secondDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer + sizeof(uint)); 243thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 287Unsafe.WriteUnaligned(pOutputBuffer, ExtractTwoCharsPackedFromTwoAdjacentTwoByteSequences(thisDWord)); 298thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 387thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 410thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 485if (outputCharsRemaining > 1 && (nint)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) >= 3) 494uint secondDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer + 3); 550thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 627Unsafe.WriteUnaligned(pOutputBuffer, ExtractCharsFromFourByteSequence(thisDWord)); 638inputLength = (int)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) + 4; 901thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 929Unsafe.WriteUnaligned(pOutputBuffer, (ushort)valueToWrite); 952Unsafe.SkipInit(out nonAsciiUtf16DataMask); 954utf16Data = Unsafe.ReadUnaligned<Vector128<short>>(pInputBuffer); 990possibleNonAsciiQWord = Unsafe.ReadUnaligned<ulong>(pInputBuffer); 1005Unsafe.WriteUnaligned(pOutputBuffer, Sse2.ConvertToUInt32(Sse2.PackUnsignedSaturate(utf16Data, utf16Data).AsUInt32())); 1043Unsafe.WriteUnaligned(pOutputBuffer, Sse2.ConvertToUInt32(Sse2.PackUnsignedSaturate(utf16Data, utf16Data).AsUInt32())); 1059Unsafe.WriteUnaligned(pOutputBuffer, (ushort)(thisDWord | (thisDWord >> 8))); 1076thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 1077secondDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer + 2); 1086Unsafe.WriteUnaligned(pOutputBuffer, (ushort)(thisDWord | (thisDWord >> 8))); 1087Unsafe.WriteUnaligned(pOutputBuffer + 2, (ushort)(secondDWord | (secondDWord >> 8))); 1107Unsafe.WriteUnaligned(pOutputBuffer, (ushort)(thisDWord | (thisDWord >> 8))); 1153thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 1175Unsafe.WriteUnaligned(pOutputBuffer, ExtractTwoUtf8TwoByteSequencesFromTwoPackedUtf16Chars(thisDWord)); 1190thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 1209Unsafe.WriteUnaligned(pOutputBuffer, (ushort)ExtractUtf8TwoByteSequenceFromFirstUtf16Char(thisDWord)); 1250thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 1289thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 1347thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 1367thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 1381Unsafe.WriteUnaligned(pOutputBuffer, ExtractFourUtf8BytesFromSurrogatePair(thisDWord));
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Validation.cs (10)
72uint thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 96if ((nint)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) >= 4 * sizeof(uint)) 102thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 193thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); // no longer guaranteed to be aligned 238thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 293thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 347thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 458ulong thisQWord = Unsafe.ReadUnaligned<ulong>(pInputBuffer); 558thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer); 653inputBufferRemainingBytes = (nuint)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) + 4;
src\libraries\System.Private.CoreLib\src\System\Text\UnicodeEncoding.cs (2)
737Unsafe.WriteUnaligned(longBytes, *longChars); 1401Unsafe.WriteUnaligned(longChars, *longBytes);
src\libraries\System.Private.CoreLib\src\System\Threading\Interlocked.cs (35)
40(uint)Add(ref Unsafe.As<uint, int>(ref location), -1); 49(ulong)Add(ref Unsafe.As<ulong, long>(ref location), -1); 62(sbyte)Exchange(ref Unsafe.As<sbyte, byte>(ref location1), (byte)value); 72(short)Exchange(ref Unsafe.As<short, ushort>(ref location1), (ushort)value); 160(uint)Exchange(ref Unsafe.As<uint, int>(ref location1), (int)value); 171(ulong)Exchange(ref Unsafe.As<ulong, long>(ref location1), (long)value); 180=> Unsafe.BitCast<int, float>(Exchange(ref Unsafe.As<float, int>(ref location1), Unsafe.BitCast<float, int>(value))); 189=> Unsafe.BitCast<long, double>(Exchange(ref Unsafe.As<double, long>(ref location1), Unsafe.BitCast<double, long>(value))); 202return (IntPtr)Interlocked.Exchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value); 220return (UIntPtr)Interlocked.Exchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value); 238(sbyte)CompareExchange(ref Unsafe.As<sbyte, byte>(ref location1), (byte)value, (byte)comparand); 249(short)CompareExchange(ref Unsafe.As<short, ushort>(ref location1), (ushort)value, (ushort)comparand); 346(uint)CompareExchange(ref Unsafe.As<uint, int>(ref location1), (int)value, (int)comparand); 358(ulong)CompareExchange(ref Unsafe.As<ulong, long>(ref location1), (long)value, (long)comparand); 368=> Unsafe.BitCast<int, float>(CompareExchange(ref Unsafe.As<float, int>(ref location1), Unsafe.BitCast<float, int>(value), Unsafe.BitCast<float, int>(comparand))); 378=> Unsafe.BitCast<long, double>(CompareExchange(ref Unsafe.As<double, long>(ref location1), Unsafe.BitCast<double, long>(value), Unsafe.BitCast<double, long>(comparand))); 392return (IntPtr)Interlocked.CompareExchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value, (long)comparand); 411return (UIntPtr)Interlocked.CompareExchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value, (long)comparand); 427(uint)Add(ref Unsafe.As<uint, int>(ref location1), (int)value); 437(ulong)Add(ref Unsafe.As<ulong, long>(ref location1), (long)value); 447CompareExchange(ref Unsafe.AsRef(in location), 0, 0); 481(uint)And(ref Unsafe.As<uint, int>(ref location1), (int)value); 513(ulong)And(ref Unsafe.As<ulong, long>(ref location1), (long)value); 547(uint)Or(ref Unsafe.As<uint, int>(ref location1), (int)value); 579(ulong)Or(ref Unsafe.As<ulong, long>(ref location1), (long)value);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
2384Unsafe.As<Task>(obj).InnerInvoke(); 6671return WhenAnyCore((ReadOnlySpan<TTask>)CollectionsMarshal.AsSpan(Unsafe.As<List<TTask>>(tasks)));
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ValueTask.cs (12)
179GetTaskForValueTaskSource(Unsafe.As<IValueTaskSource>(obj)); 313return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) != ValueTaskSourceStatus.Pending; 336return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Succeeded; 358return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Faulted; 385return Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Canceled; 404Unsafe.As<IValueTaskSource>(obj).GetResult(_token); 587return GetTaskForValueTaskSource(Unsafe.As<IValueTaskSource<TResult>>(obj)); 719return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) != ValueTaskSourceStatus.Pending; 742return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Succeeded; 764return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Faulted; 791return Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Canceled; 816return Unsafe.As<IValueTaskSource<TResult>>(obj).GetResult(_token);
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadBlockingInfo.cs (4)
72t_first = (ThreadBlockingInfo*)Unsafe.AsPointer(ref this); 111return ((Lock)Unsafe.AsRef<object>(_objectPtr)).OwningOSThreadId; 144return ((Lock)Unsafe.AsRef<object>(_objectPtr)).OwningManagedThreadId; 173_blockingInfo.Push(Unsafe.AsPointer(ref _object), objectKind, timeoutMs);
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadInt64PersistentCounter.cs (2)
31Unsafe.As<ThreadLocalNode>(threadLocalCountObject).Increment(); 38Unsafe.As<ThreadLocalNode>(threadLocalCountObject).Add(count);
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (1)
1012Unsafe.As<IThreadPoolWorkItem>(workItem).Execute();
src\libraries\System.Private.CoreLib\src\System\Threading\Volatile.cs (43)
22Unsafe.As<bool, VolatileBoolean>(ref Unsafe.AsRef(in location)).Value; 27Unsafe.As<bool, VolatileBoolean>(ref location).Value = value; 36Unsafe.As<byte, VolatileByte>(ref Unsafe.AsRef(in location)).Value; 41Unsafe.As<byte, VolatileByte>(ref location).Value = value; 49long result = Read(ref Unsafe.As<double, long>(ref Unsafe.AsRef(in location))); 56Write(ref Unsafe.As<double, long>(ref location), BitConverter.DoubleToInt64Bits(value)); 65Unsafe.As<short, VolatileInt16>(ref Unsafe.AsRef(in location)).Value; 70Unsafe.As<short, VolatileInt16>(ref location).Value = value; 79Unsafe.As<int, VolatileInt32>(ref Unsafe.AsRef(in location)).Value; 84Unsafe.As<int, VolatileInt32>(ref location).Value = value; 92(long)Unsafe.As<long, VolatileIntPtr>(ref Unsafe.AsRef(in location)).Value; 102Unsafe.As<long, VolatileIntPtr>(ref location).Value = (nint)value; 115Unsafe.As<IntPtr, VolatileIntPtr>(ref Unsafe.AsRef(in location)).Value; 120Unsafe.As<IntPtr, VolatileIntPtr>(ref location).Value = value; 130Unsafe.As<sbyte, VolatileSByte>(ref Unsafe.AsRef(in location)).Value; 136Unsafe.As<sbyte, VolatileSByte>(ref location).Value = value; 145Unsafe.As<float, VolatileSingle>(ref Unsafe.AsRef(in location)).Value; 150Unsafe.As<float, VolatileSingle>(ref location).Value = value; 160Unsafe.As<ushort, VolatileUInt16>(ref Unsafe.AsRef(in location)).Value; 166Unsafe.As<ushort, VolatileUInt16>(ref location).Value = value; 176Unsafe.As<uint, VolatileUInt32>(ref Unsafe.AsRef(in location)).Value; 182Unsafe.As<uint, VolatileUInt32>(ref location).Value = value; 190(ulong)Read(ref Unsafe.As<ulong, long>(ref Unsafe.AsRef(in location))); 196Write(ref Unsafe.As<ulong, long>(ref location), (long)value); 206Unsafe.As<UIntPtr, VolatileUIntPtr>(ref Unsafe.AsRef(in location)).Value; 212Unsafe.As<UIntPtr, VolatileUIntPtr>(ref location).Value = value; 222Unsafe.As<T>(Unsafe.As<T, VolatileObject>(ref Unsafe.AsRef(in location)).Value); 227Unsafe.As<T, VolatileObject>(ref location).Value = value;
src\libraries\System.Private.CoreLib\src\System\TypedReference.cs (1)
80internal bool IsNull => Unsafe.IsNullRef(ref _value) && _type == IntPtr.Zero;
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (19)
751Unsafe.WriteUnaligned(ref address, lower); 752Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref address, sizeof(ulong)), upper); 869sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - Size); 872result = Unsafe.ReadUnaligned<UInt128>(ref sourceRef); 888result |= Unsafe.Add(ref sourceRef, i); 927result = Unsafe.ReadUnaligned<UInt128>(ref sourceRef); 944UInt128 part = Unsafe.Add(ref sourceRef, i); 980Unsafe.WriteUnaligned(ref address, upper); 981Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref address, sizeof(ulong)), lower); 1167Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 0), (uint)(quotient._lower >> 00)); 1168Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 1), (uint)(quotient._lower >> 32)); 1170Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 2), (uint)(quotient._upper >> 00)); 1171Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 3), (uint)(quotient._upper >> 32)); 1179Unsafe.WriteUnaligned(ref *(byte*)(pRight + 0), (uint)(divisor._lower >> 00)); 1180Unsafe.WriteUnaligned(ref *(byte*)(pRight + 1), (uint)(divisor._lower >> 32)); 1182Unsafe.WriteUnaligned(ref *(byte*)(pRight + 2), (uint)(divisor._upper >> 00)); 1183Unsafe.WriteUnaligned(ref *(byte*)(pRight + 3), (uint)(divisor._upper >> 32));
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (5)
322sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(ushort)); 325result = Unsafe.ReadUnaligned<ushort>(ref sourceRef); 373result = Unsafe.ReadUnaligned<ushort>(ref sourceRef); 403Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 421Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (7)
337sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(uint)); 340result = Unsafe.ReadUnaligned<uint>(ref sourceRef); 356result |= Unsafe.Add(ref sourceRef, i); 395result = Unsafe.ReadUnaligned<uint>(ref sourceRef); 412uint part = Unsafe.Add(ref sourceRef, i); 435Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 453Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (7)
336sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(ulong)); 339result = Unsafe.ReadUnaligned<ulong>(ref sourceRef); 355result |= Unsafe.Add(ref sourceRef, i); 394result = Unsafe.ReadUnaligned<ulong>(ref sourceRef); 411ulong part = Unsafe.Add(ref sourceRef, i); 434Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 452Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (25)
223Unsafe.SkipInit(out result); 224return nuint_t.TryParse(s, out Unsafe.As<nuint, nuint_t>(ref result)); 234Unsafe.SkipInit(out result); 235return nuint_t.TryParse(s, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 240Unsafe.SkipInit(out result); 241return nuint_t.TryParse(s, style, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 246Unsafe.SkipInit(out result); 247return nuint_t.TryParse(s, out Unsafe.As<nuint, nuint_t>(ref result)); 256Unsafe.SkipInit(out result); 257return nuint_t.TryParse(utf8Text, out Unsafe.As<nuint, nuint_t>(ref result)); 263Unsafe.SkipInit(out result); 264return nuint_t.TryParse(s, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 269Unsafe.SkipInit(out result); 270return nuint_t.TryParse(s, style, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 346sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - sizeof(nuint_t)); 349result = Unsafe.ReadUnaligned<nuint>(ref sourceRef); 365result |= Unsafe.Add(ref sourceRef, i); 404result = Unsafe.ReadUnaligned<nuint>(ref sourceRef); 421nuint part = Unsafe.Add(ref sourceRef, i); 449Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 472Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 1236Unsafe.SkipInit(out result); 1237return nuint_t.TryParse(utf8Text, style, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 1246Unsafe.SkipInit(out result); 1247return nuint_t.TryParse(utf8Text, provider, out Unsafe.As<nuint, nuint_t>(ref result));
src\libraries\System.Private.CoreLib\src\System\WeakReference.T.cs (2)
144target = Unsafe.As<T?>(ComAwareWeakReference.GetTarget(th)); 154target = Unsafe.As<T?>(GCHandle.InternalGet(th));
src\System\Array.CoreCLR.cs (104)
71ref byte src = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(sourceArray), (uint)sourceIndex * elementSize); 72ref byte dst = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(destinationArray), (uint)destinationIndex * elementSize); 161ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex); 162ref byte data = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(destinationArray), (nuint)destinationIndex * destSize); 166object? obj = Unsafe.Add(ref srcData, i); 171ref byte dest = ref Unsafe.AddByteOffset(ref data, (nuint)i * destSize); 204ref byte data = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcSize); 205ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex); 209object? obj = RuntimeHelpers.Box(pSrcMT, ref Unsafe.AddByteOffset(ref data, (nuint)i * srcSize)); 210Unsafe.Add(ref destData, i) = obj; 219ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex); 220ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex); 224object? obj = Unsafe.Add(ref srcData, i); 229Unsafe.Add(ref destData, i) = CastHelpers.ChkCastAny(destTH, obj); 244ref byte srcData = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcElSize); 245ref byte data = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(destinationArray), (nuint)destinationIndex * destElSize); 249ref byte srcElement = ref Unsafe.Add(ref srcData, (nuint)i * srcElSize); 250ref byte destElement = ref Unsafe.Add(ref data, (nuint)i * destElSize); 260Unsafe.As<byte, ushort>(ref destElement) = srcElement; break; 263Unsafe.As<byte, uint>(ref destElement) = srcElement; break; 266Unsafe.As<byte, ulong>(ref destElement) = srcElement; break; 268Unsafe.As<byte, float>(ref destElement) = srcElement; break; 270Unsafe.As<byte, double>(ref destElement) = srcElement; break; 280Unsafe.As<byte, short>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 282Unsafe.As<byte, int>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 284Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 286Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 288Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 301Unsafe.As<byte, ushort>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 304Unsafe.As<byte, uint>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 307Unsafe.As<byte, ulong>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 309Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 311Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 321Unsafe.As<byte, int>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 323Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 325Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 327Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 338Unsafe.As<byte, ulong>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break; 340Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break; 342Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break; 352Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break; 354Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break; 356Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break; 366Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, ulong>(ref srcElement); break; 368Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, ulong>(ref srcElement); break; 378Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, long>(ref srcElement); break; 380Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, long>(ref srcElement); break; 388Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, float>(ref srcElement); break; 427SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, IntPtr>(ref pStart), totalByteLength / (nuint)sizeof(IntPtr)); 441ref byte p = ref Unsafe.As<RawArrayData>(array).Data; 448lowerBound = Unsafe.Add(ref Unsafe.As<byte, int>(ref p), rank); 449p = ref Unsafe.Add(ref p, 2 * sizeof(int) * rank); // skip the bounds 459ref byte ptr = ref Unsafe.AddByteOffset(ref p, (uint)offset * elementSize); 463SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, IntPtr>(ref ptr), byteLength / (uint)sizeof(IntPtr)); 478rawIndex -= Unsafe.Add(ref bounds, 1); 497int index = indices[i] - Unsafe.Add(ref bounds, indices.Length + i); 498int length = Unsafe.Add(ref bounds, i); 538ref byte offsetDataRef = ref Unsafe.Add(ref arrayDataRef, flattenedIndex * pMethodTable->ComponentSize); 546ref object elementRef = ref Unsafe.As<byte, object>(ref arrayDataRef); 547ref object offsetElementRef = ref Unsafe.Add(ref elementRef, (nuint)flattenedIndex); 560public int Length => checked((int)Unsafe.As<RawArrayData>(this).Length); 563internal nuint NativeLength => Unsafe.As<RawArrayData>(this).Length; 586return Unsafe.Add(ref RuntimeHelpers.GetMultiDimensionalArrayBounds(this), dimension); 600return Unsafe.Add(ref bounds, dimension) + Unsafe.Add(ref bounds, rank + dimension) - 1; 613return Unsafe.Add(ref RuntimeHelpers.GetMultiDimensionalArrayBounds(this), rank + dimension); 658arrayRef = ref Unsafe.Add(ref arrayRef, elementSize); 712T[] @this = Unsafe.As<T[]>(this); 722T[] @this = Unsafe.As<T[]>(this); 730T[] @this = Unsafe.As<T[]>(this); 738T[] @this = Unsafe.As<T[]>(this); 751T[] @this = Unsafe.As<T[]>(this); 770T[] @this = Unsafe.As<T[]>(this); 791T[] @this = Unsafe.As<T[]>(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\GC.CoreCLR.cs (3)
781return Unsafe.As<T[]>(AllocateNewArray(RuntimeTypeHandle.ToIntPtr(typeof(T[]).TypeHandle), length, flags)); 799return Unsafe.As<T[]>(AllocateNewArray(RuntimeTypeHandle.ToIntPtr(typeof(T[]).TypeHandle), length, flags)); 832ref GCConfigurationContext context = ref Unsafe.As<byte, GCConfigurationContext>(ref *(byte*)configurationContext);
src\System\MulticastDelegate.CoreCLR.cs (1)
57MulticastDelegate d = Unsafe.As<MulticastDelegate>(obj);
src\System\Reflection\RuntimeCustomAttributeData.cs (1)
1546int data = Unsafe.ReadUnaligned<int>((void*)blobStart);
src\System\Reflection\TypeNameResolver.CoreCLR.cs (1)
177assembly = RuntimeAssembly.InternalLoad(assemblyName, ref Unsafe.NullRef<StackCrawlMark>(),
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 (8)
262ref Unsafe.As<RawData>(obj).Data; 272rawSize += (uint)Unsafe.As<RawArrayData>(obj).Length * (nuint)pMT->ComponentSize; 293return ref Unsafe.As<byte, int>(ref Unsafe.As<RawArrayData>(array).Data); 344return (MethodTable*)Unsafe.Add(ref Unsafe.As<byte, IntPtr>(ref obj.GetRawData()), -1); 458return Unsafe.As<byte, object?>(ref target); 473/// This API returns the same value as <see cref="Unsafe.SizeOf{T}"/> for the type that <paramref name="type"/> represents.
src\System\Runtime\InteropServices\ComWrappers.cs (1)
97return Unsafe.As<T>(GCHandle.InternalGet(comInstance->GcHandle));
src\System\Runtime\InteropServices\Marshal.CoreCLR.cs (5)
262structMarshalStub(ref structure.GetRawData(), (byte*)ptr, MarshalOperation.Cleanup, ref Unsafe.NullRef<CleanupWorkListElement?>()); 265structMarshalStub(ref structure.GetRawData(), (byte*)ptr, MarshalOperation.Marshal, ref Unsafe.NullRef<CleanupWorkListElement?>()); 290structMarshalStub(ref structure.GetRawData(), (byte*)ptr, MarshalOperation.Unmarshal, ref Unsafe.NullRef<CleanupWorkListElement?>()); 324structMarshalStub(ref Unsafe.NullRef<byte>(), (byte*)ptr, MarshalOperation.Cleanup, ref Unsafe.NullRef<CleanupWorkListElement?>());
src\System\Runtime\InteropServices\MemoryMarshal.CoreCLR.cs (2)
44return ref Unsafe.AddByteOffset(ref Unsafe.As<RawData>(array).Data, (nuint)RuntimeHelpers.GetMethodTable(array)->BaseSize - (nuint)(2 * sizeof(IntPtr)));
src\System\RuntimeType.CoreCLR.cs (2)
2429return Unsafe.As<RuntimeTypeCache>(cache); 2446return Unsafe.As<RuntimeTypeCache>(cache);
src\System\String.CoreCLR.cs (1)
41SpanHelpers.Memmove(ref *(byte*)dest, ref Unsafe.As<char, byte>(ref src.GetRawStringData()), (nuint)len);
src\System\StubHelpers.cs (3)
504if (Unsafe.IsNullRef(ref cleanupWorkList)) 1571structMarshalStub(ref obj.GetRawData(), pNative, MarshalOperation.Unmarshal, ref Unsafe.NullRef<CleanupWorkListElement?>()); 1590structMarshalStub(ref obj.GetRawData(), pNative, MarshalOperation.Cleanup, ref Unsafe.NullRef<CleanupWorkListElement?>());
src\System\Threading\Interlocked.CoreCLR.cs (7)
97if (Unsafe.IsNullRef(ref location1)) 119Unsafe.As<T>(Exchange(ref Unsafe.As<T, object?>(ref location1), value)); 178if (Unsafe.IsNullRef(ref location1)) 208Unsafe.As<T>(CompareExchange(ref Unsafe.As<T, object?>(ref location1), value, comparand)); 266CompareExchange(ref Unsafe.AsRef(in location), 0, 0);
src\System\TypedReference.CoreCLR.cs (1)
46result = Unsafe.As<byte, object>(ref value._value);
src\System\ValueType.cs (8)
126hashCode.Add(Unsafe.As<byte, object>(ref Unsafe.AddByteOffset(ref rawData, fieldOffset)).GetHashCode()); 130hashCode.Add(Unsafe.As<byte, double>(ref Unsafe.AddByteOffset(ref rawData, fieldOffset)).GetHashCode()); 134hashCode.Add(Unsafe.As<byte, float>(ref Unsafe.AddByteOffset(ref rawData, fieldOffset)).GetHashCode()); 139hashCode.AddBytes(MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AddByteOffset(ref rawData, fieldOffset), (int)fieldSize)); 145hashCode.Add(RuntimeHelpers.Box(fieldMT, ref Unsafe.AddByteOffset(ref rawData, fieldOffset))?.GetHashCode() ?? 0);
System.Private.DataContractSerialization (11)
System\Xml\XmlBinaryWriter.cs (11)
107byte[] buffer = GetTextNodeBuffer(1 + Unsafe.SizeOf<T>(), out int offset); 109Debug.Assert(offset >= 0 && offset + 1 + Unsafe.SizeOf<T>() <= buffer.Length, "WriteTextNodeRaw"); 110ref byte bytePtr = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(buffer), offset); 113Unsafe.WriteUnaligned<T>(ref Unsafe.Add(ref bytePtr, 1), value); 114Advance(1 + Unsafe.SizeOf<T>()); 122byte[] buffer = GetBuffer(Unsafe.SizeOf<T>(), out int offset); 124Debug.Assert(offset >= 0 && offset + Unsafe.SizeOf<T>() <= buffer.Length, "WriteRaw"); 125ref byte bytePtr = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(buffer), offset); 126Unsafe.WriteUnaligned<T>(ref bytePtr, value); 127Advance(Unsafe.SizeOf<T>());
System.Private.Uri (5)
System\Uri.cs (2)
207Interlocked.Or(ref Unsafe.As<Flags, ulong>(ref _flags), (ulong)flags); 2401ulong oldValue = Interlocked.CompareExchange(ref Unsafe.As<Flags, ulong>(ref _flags), (ulong)newValue, (ulong)current);
System\UriExt.cs (1)
629!Unsafe.AreSame(ref MemoryMarshal.GetReference(charsToUnescape), ref MemoryMarshal.GetReference(destination));
System\UriScheme.cs (1)
80ulong previous = Interlocked.Or(ref Unsafe.As<Uri.Flags, ulong>(ref uri._flags), (ulong)Uri.Flags.CustomParser_ParseMinimalAlreadyCalled);
System\UriSyntax.cs (1)
272Interlocked.Or(ref Unsafe.As<Uri.Flags, ulong>(ref thisUri._flags), (ulong)Uri.Flags.CustomParser_ParseMinimalAlreadyCalled);
System.Private.Xml (1)
System\Xml\XmlCharType.cs (1)
186private static uint GetCharProperties(char ch) => Unsafe.Add(ref MemoryMarshal.GetReference(CharProperties), ch);
System.Reflection.Metadata (8)
System\Reflection\Internal\Utilities\BlobUtilities.cs (5)
46Unsafe.WriteUnaligned(ref buffer[start], !BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value); 49Unsafe.WriteUnaligned(ref buffer[start], BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value); 52Unsafe.WriteUnaligned(ref buffer[start], BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value); 55Unsafe.WriteUnaligned(ref buffer[start], !BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value); 58Unsafe.WriteUnaligned(ref buffer[start], !BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value);
System\Reflection\Internal\Utilities\MemoryBlock.cs (3)
130uint result = Unsafe.ReadUnaligned<uint>(Pointer + offset); 188ushort result = Unsafe.ReadUnaligned<ushort>(Pointer + offset); 248return Unsafe.ReadUnaligned<Guid>(ptr);
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net9.0\System.Runtime.Forwards.cs (1)
618[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.Unsafe))]
System.Runtime.CompilerServices.Unsafe (1)
System.Runtime.CompilerServices.Unsafe.cs (1)
4[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.Unsafe))]
System.Runtime.Numerics (59)
src\libraries\Common\src\System\Number.NumberBuffer.cs (1)
53DigitsPtr = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(digits)); // Safe since memory must be fixed
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (4)
28uint index = Unsafe.Add(ref MemoryMarshal.GetReference(log2ToPow10), BitOperations.Log2(value)); 56ulong powerOf10 = Unsafe.Add(ref MemoryMarshal.GetReference(powersOf10), index); 61return (int)(index - Unsafe.As<bool, byte>(ref lessThan)); // while arbitrary bools may be non-0/1, comparison operators are expected to return 0/1 106long tableValue = Unsafe.Add(ref MemoryMarshal.GetReference(table), uint.Log2(value));
System\Number.BigInteger.cs (2)
1079ref TChar lastWholeBlockStart = ref Unsafe.Add(ref MemoryMarshal.GetReference(input), input.Length - TParser.DigitsPerBlock); 1084MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Subtract(ref lastWholeBlockStart, i * TParser.DigitsPerBlock), TParser.DigitsPerBlock),
System\Numerics\BigInteger.cs (25)
3604Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 3611ref byte address = ref Unsafe.Add(ref startAddress, (bits.Length - 1) * sizeof(uint)); 3622Unsafe.WriteUnaligned(ref address, part); 3623address = ref Unsafe.Subtract(ref address, sizeof(uint)); 3632ref byte address = ref Unsafe.Add(ref startAddress, byteCount - sizeof(uint)); 3647Unsafe.WriteUnaligned(ref address, part); 3648address = ref Unsafe.Subtract(ref address, sizeof(uint)); 3664Unsafe.WriteUnaligned(ref address, part); 3665address = ref Unsafe.Subtract(ref address, sizeof(uint)); 3670if (Unsafe.AreSame(ref address, ref startAddress)) 3674Unsafe.WriteUnaligned(ref address, uint.MaxValue); 3679Debug.Assert(Unsafe.AreSame(ref startAddress, ref Unsafe.Add(ref address, sizeof(uint)))); 3706Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value); 3723Unsafe.WriteUnaligned(ref address, part); 3724address = ref Unsafe.Add(ref address, sizeof(uint)); 3733ref byte lastAddress = ref Unsafe.Add(ref address, byteCount - sizeof(uint)); 3748Unsafe.WriteUnaligned(ref address, part); 3749address = ref Unsafe.Add(ref address, sizeof(uint)); 3765Unsafe.WriteUnaligned(ref address, part); 3766address = ref Unsafe.Add(ref address, sizeof(uint)); 3771if (Unsafe.AreSame(ref address, ref lastAddress)) 3775Unsafe.WriteUnaligned(ref address, uint.MaxValue); 3780Debug.Assert(Unsafe.AreSame(ref lastAddress, ref Unsafe.Subtract(ref address, sizeof(uint))));
System\Numerics\BigIntegerCalculator.AddSub.cs (16)
49carry += Unsafe.Add(ref leftPtr, i); 50carry += Unsafe.Add(ref rightPtr, i); 51Unsafe.Add(ref resultPtr, i) = unchecked((uint)carry); 76long digit = (Unsafe.Add(ref leftPtr, i) + carry) + right[i]; 77Unsafe.Add(ref leftPtr, i) = unchecked((uint)digit); 122carry += Unsafe.Add(ref leftPtr, i); 123carry -= Unsafe.Add(ref rightPtr, i); 124Unsafe.Add(ref resultPtr, i) = unchecked((uint)carry); 151long digit = (Unsafe.Add(ref leftPtr, i) + carry) - right[i]; 152Unsafe.Add(ref leftPtr, i) = unchecked((uint)digit); 181Unsafe.Add(ref resultPtr, i) = unchecked((uint)carry); 185Unsafe.Add(ref resultPtr, left.Length) = unchecked((uint)carry); 192Unsafe.Add(ref resultPtr, i) = unchecked((uint)carry); 204Unsafe.Add(ref resultPtr, left.Length) = unchecked((uint)carry); 228Unsafe.Add(ref resultPtr, i) = unchecked((uint)carry); 237Unsafe.Add(ref resultPtr, i) = unchecked((uint)carry);
System\Numerics\BigIntegerCalculator.SquMul.cs (11)
57ulong digit1 = Unsafe.Add(ref resultPtr, i + j) + carry; 59Unsafe.Add(ref resultPtr, i + j) = unchecked((uint)(digit1 + (digit2 << 1))); 63Unsafe.Add(ref resultPtr, i + i) = unchecked((uint)digits); 64Unsafe.Add(ref resultPtr, i + i + 1) = (uint)(digits >> 32); 352ref uint elementPtr = ref Unsafe.Add(ref resultPtr, i + j); 357Unsafe.Add(ref resultPtr, i + left.Length) = (uint)carry; 384long digit = (Unsafe.Add(ref corePtr, i) + carry) - Unsafe.Add(ref leftPtr, i) - right[i]; 385Unsafe.Add(ref corePtr, i) = unchecked((uint)digit); 391long digit = (Unsafe.Add(ref corePtr, i) + carry) - left[i]; 392Unsafe.Add(ref corePtr, i) = unchecked((uint)digit);
System.Runtime.Serialization.Formatters (1)
System\Runtime\Serialization\Formatters\Binary\BinaryFormatterWriter.cs (1)
90long dateData = Unsafe.As<DateTime, long>(ref value);
System.Security.Cryptography (8)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (1)
40if (!Unsafe.IsNullRef(ref MemoryMarshal.GetReference(password)))
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs (3)
121ref Unsafe.NullRef<byte>(), 123ref Unsafe.NullRef<byte>(), 237if (!EvpCipherSetCcmTag(ctx, ref Unsafe.NullRef<byte>(), tagLength))
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
127if (Unsafe.IsNullRef(ref MemoryMarshal.GetReference(password)))
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\X509Certificates\UnixPkcs12Reader.cs (1)
139NativeMemory.Free(Unsafe.AsPointer(ref MemoryMarshal.GetReference(tmp)));
System.Text.Encoding.CodePages (2)
System\Text\DBCSCodePageEncoding.cs (1)
123Unsafe.InitBlockUnaligned(pNativeMemory, 0, (uint)sizeToAllocate);
System\Text\SBCSCodePageEncoding.cs (1)
86Unsafe.InitBlockUnaligned(pNativeMemory, 0, (uint)bytesToAllocate);
System.Text.Encodings.Web (19)
System\Text\Encodings\Web\OptimizedInboxTextEncoder.AdvSimd64.cs (1)
97Vector128<byte> packed = Vector128.CreateScalarUnsafe(Unsafe.ReadUnaligned<uint>(pData + i)).AsByte();
System\Text\Encodings\Web\OptimizedInboxTextEncoder.cs (1)
49allowedCodePointsBmp = ref Unsafe.NullRef<AllowedBmpCodePointsBitmap>();
System\Text\Encodings\Web\SpanUtility.cs (17)
48Unsafe.WriteUnaligned<uint>(ref MemoryMarshal.GetReference(span), abcd32); 79Unsafe.WriteUnaligned<uint>(ref rDest, abcd32); 80Unsafe.Add(ref rDest, 4) = e; 114Unsafe.WriteUnaligned<uint>(ref rDest, abcd32); 115Unsafe.WriteUnaligned<ushort>(ref Unsafe.Add(ref rDest, 4), (ushort)ef16); 145Unsafe.WriteUnaligned<ulong>(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(span)), abcd64); 176Unsafe.WriteUnaligned<ulong>(ref Unsafe.As<char, byte>(ref rDest), abcd64); 177Unsafe.Add(ref rDest, 4) = e; 210ref byte rDest = ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(span)); 211Unsafe.WriteUnaligned<ulong>(ref rDest, abcd64); 212Unsafe.WriteUnaligned<uint>(ref Unsafe.AddByteOffset(ref rDest, (nint)sizeof(ulong)), ef32); 234Unsafe.WriteUnaligned<ulong>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)offset), value);
System.Text.Json (33)
System\Text\Json\Document\JsonElement.cs (2)
1247return Unsafe.IsNullRef(ref MemoryMarshal.GetReference(utf8Text)); 1275return Unsafe.IsNullRef(ref MemoryMarshal.GetReference(text));
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (24)
141return Unsafe.As<int, T>(ref int32); 147return Unsafe.As<uint, T>(ref uint32); 153return Unsafe.As<ulong, T>(ref uint64); 159return Unsafe.As<long, T>(ref int64); 165return Unsafe.As<sbyte, T>(ref byte8); 171return Unsafe.As<byte, T>(ref ubyte8); 177return Unsafe.As<short, T>(ref int16); 183return Unsafe.As<ushort, T>(ref uint16); 242writer.WriteNumberValue(Unsafe.As<T, int>(ref value)); 245writer.WriteNumberValue(Unsafe.As<T, uint>(ref value)); 248writer.WriteNumberValue(Unsafe.As<T, ulong>(ref value)); 251writer.WriteNumberValue(Unsafe.As<T, long>(ref value)); 254writer.WriteNumberValue(Unsafe.As<T, short>(ref value)); 257writer.WriteNumberValue(Unsafe.As<T, ushort>(ref value)); 260writer.WriteNumberValue(Unsafe.As<T, byte>(ref value)); 263writer.WriteNumberValue(Unsafe.As<T, sbyte>(ref value)); 335writer.WritePropertyName(Unsafe.As<T, int>(ref value)); 338writer.WritePropertyName(Unsafe.As<T, uint>(ref value)); 341writer.WritePropertyName(Unsafe.As<T, ulong>(ref value)); 344writer.WritePropertyName(Unsafe.As<T, long>(ref value)); 347writer.WritePropertyName(Unsafe.As<T, short>(ref value)); 350writer.WritePropertyName(Unsafe.As<T, ushort>(ref value)); 353writer.WritePropertyName(Unsafe.As<T, byte>(ref value)); 356writer.WritePropertyName(Unsafe.As<T, sbyte>(ref value));
System\Text\Json\Serialization\Metadata\JsonTypeInfo.Cache.cs (7)
427key = Unsafe.ReadUnaligned<ulong>(ref reference) & 0x00ffffffffffffffL; 433length > 5 ? Unsafe.ReadUnaligned<uint>(ref reference) | (ulong)Unsafe.ReadUnaligned<ushort>(ref Unsafe.Add(ref reference, 4)) << 32 : 434length > 3 ? Unsafe.ReadUnaligned<uint>(ref reference) : 435length > 1 ? Unsafe.ReadUnaligned<ushort>(ref reference) : 0UL; 441key |= (ulong)Unsafe.Add(ref reference, offset) << (offset * 8);
System.Text.RegularExpressions (1)
System\Text\RegularExpressions\RegexCompiler.cs (1)
104private static readonly MethodInfo s_unsafeAs = typeof(Unsafe).GetMethod("As", [typeof(object)])!;
System.Text.RegularExpressions.Generator (1)
Stubs.cs (1)
92uint oldValue = (uint)Interlocked.CompareExchange(ref Unsafe.As<uint, int>(ref location1), (int)newValue, (int)current);
System.Threading.Tasks.Parallel (28)
System\Threading\Tasks\Parallel.ForEachAsync.cs (16)
112sizeof(T) == sizeof(byte) ? Interlocked.CompareExchange(ref Unsafe.As<T, byte>(ref location), Unsafe.As<T, byte>(ref value), Unsafe.As<T, byte>(ref comparand)) == Unsafe.As<T, byte>(ref comparand) : 113sizeof(T) == sizeof(ushort) ? Interlocked.CompareExchange(ref Unsafe.As<T, ushort>(ref location), Unsafe.As<T, ushort>(ref value), Unsafe.As<T, ushort>(ref comparand)) == Unsafe.As<T, ushort>(ref comparand) : 114sizeof(T) == sizeof(uint) ? Interlocked.CompareExchange(ref Unsafe.As<T, uint>(ref location), Unsafe.As<T, uint>(ref value), Unsafe.As<T, uint>(ref comparand)) == Unsafe.As<T, uint>(ref comparand) : 115sizeof(T) == sizeof(ulong) ? Interlocked.CompareExchange(ref Unsafe.As<T, ulong>(ref location), Unsafe.As<T, ulong>(ref value), Unsafe.As<T, ulong>(ref comparand)) == Unsafe.As<T, ulong>(ref comparand) :
System\Threading\Tasks\ParallelLoopState.cs (12)
215Interlocked.CompareExchange(ref Unsafe.As<TInt, int>(ref pflags._lowestBreakIteration), Unsafe.As<TInt, int>(ref iteration), Unsafe.As<TInt, int>(ref oldLBI)) != Unsafe.As<TInt, int>(ref oldLBI) : 216Interlocked.CompareExchange(ref Unsafe.As<TInt, long>(ref pflags._lowestBreakIteration), Unsafe.As<TInt, long>(ref iteration), Unsafe.As<TInt, long>(ref oldLBI)) != Unsafe.As<TInt, long>(ref oldLBI)) 364return Unsafe.BitCast<int, TInt>(Volatile.Read(ref Unsafe.As<TInt, int>(ref _lowestBreakIteration))); 368return Unsafe.BitCast<long, TInt>(Volatile.Read(ref Unsafe.As<TInt, long>(ref _lowestBreakIteration)));