src\libraries\System.Private.CoreLib\src\System\Array.cs (75)
380ref byte src = ref Unsafe.As<RawArrayData>(sourceArray).Data;
381ref byte dst = ref Unsafe.As<RawArrayData>(destinationArray).Data;
412ref byte src = ref Unsafe.AddByteOffset(ref Unsafe.As<RawArrayData>(sourceArray).Data, (uint)sourceIndex * elementSize);
413ref byte dst = ref Unsafe.AddByteOffset(ref Unsafe.As<RawArrayData>(destinationArray).Data, (uint)destinationIndex * elementSize);
463ref byte src = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(sourceArray), (uint)sourceIndex * elementSize);
464ref byte dst = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(destinationArray), (uint)destinationIndex * elementSize);
538ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex);
539ref byte destData = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(destinationArray), (nuint)destinationIndex * destSize);
543object? obj = Unsafe.Add(ref srcData, i);
569destData = ref Unsafe.AddByteOffset(ref destData, destSize);
583ref byte srcData = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcSize);
584ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex);
593Unsafe.Add(ref destData, i) = obj;
594srcData = ref Unsafe.AddByteOffset(ref srcData, srcSize);
606ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex);
607ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex);
611object? obj = Unsafe.Add(ref srcData, i);
619Unsafe.Add(ref destData, i) = CastHelpers.ChkCastAny(pDestMT, obj);
643ref byte srcData = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcElSize);
644ref byte destData = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(destinationArray), (nuint)destinationIndex * destElSize);
649srcData = ref Unsafe.AddByteOffset(ref srcData, srcElSize);
650destData = ref Unsafe.AddByteOffset(ref destData, destElSize);
675SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, IntPtr>(ref pStart), totalByteLength / (nuint)sizeof(IntPtr));
689ref byte p = ref Unsafe.As<RawArrayData>(array).Data;
696lowerBound = Unsafe.Add(ref Unsafe.As<byte, int>(ref p), rank);
697p = ref Unsafe.Add(ref p, 2 * sizeof(int) * rank); // skip the bounds
707ref byte ptr = ref Unsafe.AddByteOffset(ref p, (uint)offset * elementSize);
711SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, IntPtr>(ref ptr), byteLength / (uint)sizeof(IntPtr));
726rawIndex -= Unsafe.Add(ref bounds, 1);
745int index = indices[i] - Unsafe.Add(ref bounds, indices.Length + i);
746int length = Unsafe.Add(ref bounds, i);
773return Unsafe.Add(ref this.GetMultiDimensionalArrayBounds(), dimension);
787return Unsafe.Add(ref bounds, dimension)
788+ (SupportsNonZeroLowerBound ? Unsafe.Add(ref bounds, rank + dimension) : 0)
803return Unsafe.Add(ref this.GetMultiDimensionalArrayBounds(), rank + dimension);
1339=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).BinarySearch(Unsafe.As<byte, T>(ref value.GetRawData()));
1512ref T first = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)startIndex);
1835=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).IndexOf(Unsafe.As<byte, T>(ref value.GetRawData()));
1902ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex),
1903Unsafe.BitCast<T, byte>(value),
1910ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex),
1911Unsafe.BitCast<T, short>(value),
1918ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex),
1919Unsafe.BitCast<T, int>(value),
1926ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex),
1927Unsafe.BitCast<T, long>(value),
2062=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).LastIndexOf(Unsafe.As<byte, T>(ref value.GetRawData()));
2147ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex),
2148Unsafe.BitCast<T, byte>(value),
2157ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex),
2158Unsafe.BitCast<T, short>(value),
2167ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex),
2168Unsafe.BitCast<T, int>(value),
2177ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex),
2178Unsafe.BitCast<T, long>(value),
2297SpanHelpers.Reverse(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), (nuint)length);
2547var span = new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), length);
2571var spanKeys = new Span<TKey>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(keys), index), length);
2572var spanItems = new Span<TValue>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(items), index), length);
3060new 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 (39)
46Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value ? (byte)1 : (byte)0);
74Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
102Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
130Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
158Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
186Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
216Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
246Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
276Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
306Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
334Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
362Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
390Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), value);
416return Unsafe.ReadUnaligned<char>(ref MemoryMarshal.GetReference(value));
437return Unsafe.ReadUnaligned<short>(ref value[startIndex]);
451return Unsafe.ReadUnaligned<short>(ref MemoryMarshal.GetReference(value));
475return Unsafe.ReadUnaligned<int>(ref value[startIndex]);
489return Unsafe.ReadUnaligned<int>(ref MemoryMarshal.GetReference(value));
513return Unsafe.ReadUnaligned<long>(ref value[startIndex]);
527return Unsafe.ReadUnaligned<long>(ref MemoryMarshal.GetReference(value));
551return Unsafe.ReadUnaligned<Int128>(ref value[startIndex]);
565return Unsafe.ReadUnaligned<Int128>(ref MemoryMarshal.GetReference(value));
592return Unsafe.ReadUnaligned<ushort>(ref MemoryMarshal.GetReference(value));
622return Unsafe.ReadUnaligned<uint>(ref MemoryMarshal.GetReference(value));
652return Unsafe.ReadUnaligned<ulong>(ref MemoryMarshal.GetReference(value));
677return Unsafe.ReadUnaligned<UInt128>(ref value[startIndex]);
692return Unsafe.ReadUnaligned<UInt128>(ref MemoryMarshal.GetReference(value));
717return Unsafe.ReadUnaligned<Half>(ref MemoryMarshal.GetReference(value));
745return Unsafe.ReadUnaligned<float>(ref MemoryMarshal.GetReference(value));
773return Unsafe.ReadUnaligned<double>(ref MemoryMarshal.GetReference(value));
899return Unsafe.ReadUnaligned<byte>(ref MemoryMarshal.GetReference(value)) != 0;
908public static long DoubleToInt64Bits(double value) => Unsafe.BitCast<double, long>(value);
916public static double Int64BitsToDouble(long value) => Unsafe.BitCast<long, double>(value);
924public static int SingleToInt32Bits(float value) => Unsafe.BitCast<float, int>(value);
932public static float Int32BitsToSingle(int value) => Unsafe.BitCast<int, float>(value);
957public static ulong DoubleToUInt64Bits(double value) => Unsafe.BitCast<double, ulong>(value);
966public static double UInt64BitsToDouble(ulong value) => Unsafe.BitCast<ulong, double>(value);
975public static uint SingleToUInt32Bits(float value) => Unsafe.BitCast<float, uint>(value);
984public static float UInt32BitsToSingle(uint value) => Unsafe.BitCast<uint, float>(value);
src\libraries\System.Private.CoreLib\src\System\Buffer.cs (14)
53Memmove(ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(dst), uDstOffset), ref Unsafe.AddByteOffset(ref MemoryMarshal.GetArrayDataReference(src), uSrcOffset), uCount);
85return Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index);
96Unsafe.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),
198if (Unsafe.AreSame(ref source, ref destination))
202if ((nuint)(nint)Unsafe.ByteOffset(ref source, ref destination) >= byteCount)
210destination = ref Unsafe.AddByteOffset(ref destination, BulkMoveWithWriteBarrierChunk);
211source = ref Unsafe.AddByteOffset(ref source, BulkMoveWithWriteBarrierChunk);
221BulkMoveWithWriteBarrierInternal(ref Unsafe.AddByteOffset(ref destination, byteCount), ref Unsafe.AddByteOffset(ref source, byteCount), BulkMoveWithWriteBarrierChunk);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64DecoderHelper.cs (15)
174int i2 = Unsafe.Add(ref decodingMap, (IntPtr)t2);
175int i3 = Unsafe.Add(ref decodingMap, (IntPtr)t3);
197int i2 = Unsafe.Add(ref decodingMap, (IntPtr)t2);
384int i0 = Unsafe.Add(ref decodingMap, (int)t0);
385int i1 = Unsafe.Add(ref decodingMap, (int)t1);
394int i2 = Unsafe.Add(ref decodingMap, (int)t2);
395int i3 = Unsafe.Add(ref decodingMap, (int)t3);
412int i2 = Unsafe.Add(ref decodingMap, (int)t2);
558if (decoder.IsValidPadding(Unsafe.Subtract(ref ptrToLastElement, 1)))
1396int i0 = Unsafe.Add(ref decodingMap, (int)t0);
1397int i1 = Unsafe.Add(ref decodingMap, (int)t1);
1398int i2 = Unsafe.Add(ref decodingMap, (int)t2);
1399int i3 = Unsafe.Add(ref decodingMap, (int)t3);
1440int i0 = Unsafe.Add(ref decodingMap, (IntPtr)t0);
1441int i1 = Unsafe.Add(ref decodingMap, (IntPtr)t1);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64EncoderHelper.cs (13)
629Unsafe.WriteUnaligned(bufferBytes + destinationIndex, result);
648uint i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 18));
649uint i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 12) & 0x3F));
650uint i2 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 6) & 0x3F));
651uint i3 = Unsafe.Add(ref encodingMap, (IntPtr)(i & 0x3F));
705uint i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 10));
706uint i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 4) & 0x3F));
709Unsafe.WriteUnaligned(dest, result);
720uint i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 18));
721uint i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 12) & 0x3F));
722uint i2 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 6) & 0x3F));
725Unsafe.WriteUnaligned(dest, result);
769Unsafe.WriteUnaligned(destination, result);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlEncoder.cs (17)
252byte i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 10));
253byte i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 4) & 0x3F));
266Unsafe.WriteUnaligned(dest, result);
277byte i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 18));
278byte i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 12) & 0x3F));
279byte i2 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 6) & 0x3F));
346uint i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 10));
347uint i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 4) & 0x3F));
360Unsafe.WriteUnaligned(dest, result);
371ushort i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 18));
372ushort i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 12) & 0x3F));
373ushort i2 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 6) & 0x3F));
434ulong i0 = Unsafe.Add(ref encodingMap, (IntPtr)(i >> 18));
435ulong i1 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 12) & 0x3F));
436ulong i2 = Unsafe.Add(ref encodingMap, (IntPtr)((i >> 6) & 0x3F));
437ulong i3 = Unsafe.Add(ref encodingMap, (IntPtr)(i & 0x3F));
449Unsafe.WriteUnaligned(destination, result);
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\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));
549T t = Unsafe.Add(ref MemoryMarshal.GetReference(keys), i + 1);
552while (j >= 0 && (t == null || LessThan(ref t, ref Unsafe.Add(ref MemoryMarshal.GetReference(keys), j))))
554Unsafe.Add(ref MemoryMarshal.GetReference(keys), j + 1) = Unsafe.Add(ref MemoryMarshal.GetReference(keys), j);
558Unsafe.Add(ref MemoryMarshal.GetReference(keys), j + 1) = t!;
src\libraries\System.Private.CoreLib\src\System\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\Enum.cs (111)
421ushort flagsValue = Unsafe.As<byte, ushort>(ref pFlagsValue);
422return (Unsafe.As<byte, ushort>(ref pThisValue) & flagsValue) == flagsValue;
428uint flagsValue = Unsafe.As<byte, uint>(ref pFlagsValue);
429return (Unsafe.As<byte, uint>(ref pThisValue) & flagsValue) == flagsValue;
435ulong flagsValue = Unsafe.As<byte, ulong>(ref pFlagsValue);
436return (Unsafe.As<byte, ulong>(ref pThisValue) & flagsValue) == flagsValue;
890Unsafe.SkipInit(out result);
894if (underlyingType == typeof(sbyte)) return TryParseByValueOrName<sbyte, byte>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, sbyte>(ref result));
895if (underlyingType == typeof(byte)) return TryParseByValueOrName<byte, byte>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, byte>(ref result));
896if (underlyingType == typeof(short)) return TryParseByValueOrName<short, ushort>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, short>(ref result));
897if (underlyingType == typeof(ushort)) return TryParseByValueOrName<ushort, ushort>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, ushort>(ref result));
898if (underlyingType == typeof(int)) return TryParseByValueOrName<int, uint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, int>(ref result));
899if (underlyingType == typeof(uint)) return TryParseByValueOrName<uint, uint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, uint>(ref result));
900if (underlyingType == typeof(long)) return TryParseByValueOrName<long, ulong>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, long>(ref result));
901if (underlyingType == typeof(ulong)) return TryParseByValueOrName<ulong, ulong>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, ulong>(ref result));
903if (underlyingType == typeof(nint)) return TryParseRareTypeByValueOrName<nint, nuint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, nint>(ref result));
904if (underlyingType == typeof(nuint)) return TryParseRareTypeByValueOrName<nuint, nuint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, nuint>(ref result));
905if (underlyingType == typeof(float)) return TryParseRareTypeByValueOrName<float, float>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, float>(ref result));
906if (underlyingType == typeof(double)) return TryParseRareTypeByValueOrName<double, double>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, double>(ref result));
907if (underlyingType == typeof(char)) return TryParseRareTypeByValueOrName<char, char>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, char>(ref result));
937Unsafe.SkipInit(out result);
938return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result));
952Unsafe.SkipInit(out result);
953return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result));
995Unsafe.SkipInit(out result);
996return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result));
1019Unsafe.SkipInit(out result);
1020return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result));
1169CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data),
1171CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data),
1172CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data),
1173CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data),
1174CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data),
1175CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data),
1176CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data),
1178CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data),
1179CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data),
1180CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data),
1181CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data),
1182CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data),
1183CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data),
1212return Unsafe.As<byte, ushort>(ref pThisValue) == Unsafe.As<byte, ushort>(ref pOtherValue);
1216return Unsafe.As<byte, uint>(ref pThisValue) == Unsafe.As<byte, uint>(ref pOtherValue);
1220return Unsafe.As<byte, ulong>(ref pThisValue) == Unsafe.As<byte, ulong>(ref pOtherValue);
1259CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data).GetHashCode(),
1261CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data).GetHashCode(),
1262CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data).GetHashCode(),
1263CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data).GetHashCode(),
1264CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data).GetHashCode(),
1265CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data).GetHashCode(),
1266CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data).GetHashCode(),
1268CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data).GetHashCode(),
1269CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data).GetHashCode(),
1270CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data).GetHashCode(),
1271CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data).GetHashCode(),
1272CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data).GetHashCode(),
1273CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data).GetHashCode(),
1297return Unsafe.As<byte, sbyte>(ref pThisValue).CompareTo(Unsafe.As<byte, sbyte>(ref pTargetValue));
1303return Unsafe.As<byte, short>(ref pThisValue).CompareTo(Unsafe.As<byte, short>(ref pTargetValue));
1306return Unsafe.As<byte, ushort>(ref pThisValue).CompareTo(Unsafe.As<byte, ushort>(ref pTargetValue));
1309return Unsafe.As<byte, int>(ref pThisValue).CompareTo(Unsafe.As<byte, int>(ref pTargetValue));
1312return Unsafe.As<byte, uint>(ref pThisValue).CompareTo(Unsafe.As<byte, uint>(ref pTargetValue));
1315return Unsafe.As<byte, long>(ref pThisValue).CompareTo(Unsafe.As<byte, long>(ref pTargetValue));
1318return Unsafe.As<byte, ulong>(ref pThisValue).CompareTo(Unsafe.As<byte, ulong>(ref pTargetValue));
1322return Unsafe.As<byte, float>(ref pThisValue).CompareTo(Unsafe.As<byte, float>(ref pTargetValue));
1325return Unsafe.As<byte, double>(ref pThisValue).CompareTo(Unsafe.As<byte, double>(ref pTargetValue));
1469TStorage value = Unsafe.As<byte, TStorage>(ref rawData);
1476return result ?? Unsafe.BitCast<TStorage, TUnderlying>(value).ToString()!;
1499TStorage value = Unsafe.As<byte, TStorage>(ref rawData);
1514result = Unsafe.BitCast<TStorage, TUnderlying>(value).ToString()!;
1566ushort value = Unsafe.As<byte, ushort>(ref data);
1577uint value = Unsafe.As<byte, uint>(ref data);
1590ulong value = Unsafe.As<byte, ulong>(ref data);
1699CorElementType.ELEMENT_TYPE_I2 => TryFormatPrimitiveDefault<short, ushort>(enumType, Unsafe.As<byte, short>(ref rawData), destination, out charsWritten),
1700CorElementType.ELEMENT_TYPE_U2 => TryFormatPrimitiveDefault<ushort, ushort>(enumType, Unsafe.As<byte, ushort>(ref rawData), destination, out charsWritten),
1701CorElementType.ELEMENT_TYPE_I4 => TryFormatPrimitiveDefault<int, uint>(enumType, Unsafe.As<byte, int>(ref rawData), destination, out charsWritten),
1702CorElementType.ELEMENT_TYPE_U4 => TryFormatPrimitiveDefault<uint, uint>(enumType, Unsafe.As<byte, uint>(ref rawData), destination, out charsWritten),
1703CorElementType.ELEMENT_TYPE_I8 => TryFormatPrimitiveDefault<long, ulong>(enumType, Unsafe.As<byte, long>(ref rawData), destination, out charsWritten),
1704CorElementType.ELEMENT_TYPE_U8 => TryFormatPrimitiveDefault<ulong, ulong>(enumType, Unsafe.As<byte, ulong>(ref rawData), destination, out charsWritten),
1706CorElementType.ELEMENT_TYPE_R4 => TryFormatPrimitiveDefault<float, float>(enumType, Unsafe.As<byte, float>(ref rawData), destination, out charsWritten),
1707CorElementType.ELEMENT_TYPE_R8 => TryFormatPrimitiveDefault<double, double>(enumType, Unsafe.As<byte, double>(ref rawData), destination, out charsWritten),
1708CorElementType.ELEMENT_TYPE_I => TryFormatPrimitiveDefault<nint, nuint>(enumType, Unsafe.As<byte, nint>(ref rawData), destination, out charsWritten),
1709CorElementType.ELEMENT_TYPE_U => TryFormatPrimitiveDefault<nuint, nuint>(enumType, Unsafe.As<byte, nuint>(ref rawData), destination, out charsWritten),
1710CorElementType.ELEMENT_TYPE_CHAR => TryFormatPrimitiveDefault<char, char>(enumType, Unsafe.As<byte, char>(ref rawData), destination, out charsWritten),
1721CorElementType.ELEMENT_TYPE_I2 => TryFormatPrimitiveNonDefault<short, ushort>(enumType, Unsafe.As<byte, short>(ref rawData), destination, out charsWritten, format),
1722CorElementType.ELEMENT_TYPE_U2 => TryFormatPrimitiveNonDefault<ushort, ushort>(enumType, Unsafe.As<byte, ushort>(ref rawData), destination, out charsWritten, format),
1723CorElementType.ELEMENT_TYPE_I4 => TryFormatPrimitiveNonDefault<int, uint>(enumType, Unsafe.As<byte, int>(ref rawData), destination, out charsWritten, format),
1724CorElementType.ELEMENT_TYPE_U4 => TryFormatPrimitiveNonDefault<uint, uint>(enumType, Unsafe.As<byte, uint>(ref rawData), destination, out charsWritten, format),
1725CorElementType.ELEMENT_TYPE_I8 => TryFormatPrimitiveNonDefault<long, ulong>(enumType, Unsafe.As<byte, long>(ref rawData), destination, out charsWritten, format),
1726CorElementType.ELEMENT_TYPE_U8 => TryFormatPrimitiveNonDefault<ulong, ulong>(enumType, Unsafe.As<byte, ulong>(ref rawData), destination, out charsWritten, format),
1728CorElementType.ELEMENT_TYPE_R4 => TryFormatPrimitiveNonDefault<float, float>(enumType, Unsafe.As<byte, float>(ref rawData), destination, out charsWritten, format),
1729CorElementType.ELEMENT_TYPE_R8 => TryFormatPrimitiveNonDefault<double, double>(enumType, Unsafe.As<byte, double>(ref rawData), destination, out charsWritten, format),
1730CorElementType.ELEMENT_TYPE_I => TryFormatPrimitiveNonDefault<nint, nuint>(enumType, Unsafe.As<byte, nint>(ref rawData), destination, out charsWritten, format),
1731CorElementType.ELEMENT_TYPE_U => TryFormatPrimitiveNonDefault<nuint, nuint>(enumType, Unsafe.As<byte, nuint>(ref rawData), destination, out charsWritten, format),
1732CorElementType.ELEMENT_TYPE_CHAR => TryFormatPrimitiveNonDefault<char, char>(enumType, Unsafe.As<byte, char>(ref rawData), destination, out charsWritten, format),
1866if (GetNameInlined(enumInfo, Unsafe.BitCast<TUnderlying, TStorage>(value)) is string enumName)
1881if (TryFormatFlagNames(enumInfo, Unsafe.BitCast<TUnderlying, TStorage>(value), destination, out charsWritten, ref destinationIsTooSmall) || destinationIsTooSmall)
1910return TryFormatNumberAsHex<TStorage>(ref Unsafe.As<TUnderlying, byte>(ref value), destination, out charsWritten);
1914if (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);
456uint index = Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoryCasingLevel1Index), codePoint >> 9);
462ref byte level2Ref = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoryCasingLevel2Index), (index << 6) + ((codePoint >> 3) & 0b_0011_1110));
466index = Unsafe.ReadUnaligned<ushort>(ref level2Ref);
470index = BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned<ushort>(ref level2Ref));
476return Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(CategoryCasingLevel3Index), (index << 4) + (codePoint & 0x0F));
493uint index = Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericGraphemeLevel1Index), codePoint >> 9);
499ref byte level2Ref = ref Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericGraphemeLevel2Index), (index << 6) + ((codePoint >> 3) & 0b_0011_1110));
503index = Unsafe.ReadUnaligned<ushort>(ref level2Ref);
507index = BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned<ushort>(ref level2Ref));
513return Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(NumericGraphemeLevel3Index), (index << 4) + (codePoint & 0x0F));
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (5)
766result.Append(Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(s));
771Encoding.UTF8.GetBytes(s, Unsafe.BitCast<Span<TChar>, Span<byte>>(result.AppendSpan(Encoding.UTF8.GetByteCount(s))));
780fraction.TryFormat(Unsafe.BitCast<Span<TChar>, Span<char>>(chars), out charCount, fractionFormat, CultureInfo.InvariantCulture) :
781fraction.TryFormat(Unsafe.BitCast<Span<TChar>, Span<byte>>(chars), out charCount, fractionFormat, CultureInfo.InvariantCulture);
1115bool success = Unsafe.AreSame(ref MemoryMarshal.GetReference(destination), ref MemoryMarshal.GetReference(vlb.AsSpan()));
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfo.cs (10)
372Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(AMDesignator) :
373Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(amDesignatorUtf8 ??= Encoding.UTF8.GetBytes(AMDesignator));
621Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(DateSeparator) :
622Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(dateSeparatorUtf8 ??= Encoding.UTF8.GetBytes(DateSeparator));
824Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(PMDesignator) :
825Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(pmDesignatorUtf8 ??= Encoding.UTF8.GetBytes(PMDesignator));
1006Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(TimeSeparator) :
1007Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(timeSeparatorUtf8 ??= Encoding.UTF8.GetBytes(TimeSeparator));
1706Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(DecimalSeparator) :
1707Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_decimalSeparatorUtf8 ??= Encoding.UTF8.GetBytes(DecimalSeparator));
src\libraries\System.Private.CoreLib\src\System\Globalization\NumberFormatInfo.cs (28)
272Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_currencyDecimalSeparator) :
273Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_currencyDecimalSeparatorUtf8 ??= Encoding.UTF8.GetBytes(_currencyDecimalSeparator));
364Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_currencyGroupSeparator) :
365Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_currencyGroupSeparatorUtf8 ??= Encoding.UTF8.GetBytes(_currencyGroupSeparator));
386Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_currencySymbol) :
387Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_currencySymbolUtf8 ??= Encoding.UTF8.GetBytes(_currencySymbol));
432Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_nanSymbol) :
433Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_nanSymbolUtf8 ??= Encoding.UTF8.GetBytes(_nanSymbol));
517Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_negativeInfinitySymbol) :
518Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_negativeInfinitySymbolUtf8 ??= Encoding.UTF8.GetBytes(_negativeInfinitySymbol));
540Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_negativeSign) :
541Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_negativeSignUtf8 ??= Encoding.UTF8.GetBytes(_negativeSign));
576Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_numberDecimalSeparator) :
577Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_numberDecimalSeparatorUtf8 ??= Encoding.UTF8.GetBytes(_numberDecimalSeparator));
597Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_numberGroupSeparator) :
598Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_numberGroupSeparatorUtf8 ??= Encoding.UTF8.GetBytes(_numberGroupSeparator));
634Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_positiveInfinitySymbol) :
635Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_positiveInfinitySymbolUtf8 ??= Encoding.UTF8.GetBytes(_positiveInfinitySymbol));
657Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_positiveSign) :
658Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_positiveSignUtf8 ??= Encoding.UTF8.GetBytes(_positiveSign));
693Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_percentDecimalSeparator) :
694Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_percentDecimalSeparatorUtf8 ??= Encoding.UTF8.GetBytes(_percentDecimalSeparator));
714Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_percentGroupSeparator) :
715Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_percentGroupSeparatorUtf8 ??= Encoding.UTF8.GetBytes(_percentGroupSeparator));
735Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_percentSymbol) :
736Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_percentSymbolUtf8 ??= Encoding.UTF8.GetBytes(_percentSymbol));
757Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(_perMilleSymbol) :
758Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(_perMilleSymbolUtf8 ??= Encoding.UTF8.GetBytes(_perMilleSymbol));
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\Guid.cs (26)
248return Unsafe.As<GuidResult, Guid>(ref Unsafe.AsRef(in this));
324Unsafe.AsRef(in result._a) = (int)(unix_ts_ms >> 16);
325Unsafe.AsRef(in result._b) = (short)(unix_ts_ms);
327Unsafe.AsRef(in result._c) = (short)((result._c & ~VersionMask) | Version7Value);
328Unsafe.AsRef(in result._d) = (byte)((result._d & ~Variant10xxMask) | Variant10xxValue);
795Unsafe.Add(ref result._d, i) = (byte)byteVal;
889ReadOnlySpan<char> charSpan = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<char>>(str);
918return Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(new ReadOnlySpan<char>(chArr, 0, newLength));
924ReadOnlySpan<byte> srcUtf8Span = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<byte>>(str);
977return Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(destUtf8Span.Slice(0, newLength));
1066ref int r = ref Unsafe.AsRef(in _a);
1067return r ^ Unsafe.Add(ref r, 1) ^ Unsafe.Add(ref r, 2) ^ Unsafe.Add(ref r, 3);
1081return Unsafe.BitCast<Guid, Vector128<byte>>(left) == Unsafe.BitCast<Guid, Vector128<byte>>(right);
1084ref int rA = ref Unsafe.AsRef(in left._a);
1085ref int rB = ref Unsafe.AsRef(in right._a);
1090&& Unsafe.Add(ref rA, 1) == Unsafe.Add(ref rB, 1)
1091&& Unsafe.Add(ref rA, 2) == Unsafe.Add(ref rB, 2)
1092&& Unsafe.Add(ref rA, 3) == Unsafe.Add(ref rB, 3);
1517Vector128<byte> srcVec = Unsafe.BitCast<Guid, Vector128<byte>>(value);
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\IntPtr.cs (23)
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);
1418Unsafe.SkipInit(out result);
1419return nint_t.TryParse(utf8Text, style, provider, out Unsafe.As<nint, nint_t>(ref result));
1428Unsafe.SkipInit(out result);
1429return nint_t.TryParse(utf8Text, provider, out Unsafe.As<nint, nint_t>(ref result));
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\MemoryExtensions.cs (450)
39return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), array.Length - start);
63return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)actualIndex /* force zero-extension */), array.Length - actualIndex);
87return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), length);
126return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)start /* force zero-extension */), text.Length - start);
152return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)actualIndex /* force zero-extension */), text.Length - actualIndex);
178return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)start /* force zero-extension */), length);
210return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)start /* force zero-extension */), length);
335ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
336Unsafe.BitCast<T, byte>(value),
342ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
343Unsafe.BitCast<T, short>(value),
349ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
350Unsafe.BitCast<T, int>(value),
356ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
357Unsafe.BitCast<T, long>(value),
814ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
815Unsafe.BitCast<T, byte>(value),
821ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
822Unsafe.BitCast<T, short>(value),
828ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
829Unsafe.BitCast<T, int>(value),
835ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
836Unsafe.BitCast<T, long>(value),
863ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
864Unsafe.BitCast<T, byte>(value),
870ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
871Unsafe.BitCast<T, short>(value),
877ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
878Unsafe.BitCast<T, int>(value),
884ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
885Unsafe.BitCast<T, long>(value),
941ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
942Unsafe.BitCast<T, byte>(value0),
943Unsafe.BitCast<T, byte>(value1),
949ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
950Unsafe.BitCast<T, short>(value0),
951Unsafe.BitCast<T, short>(value1),
979ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
980Unsafe.BitCast<T, byte>(value0),
981Unsafe.BitCast<T, byte>(value1),
987ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
988Unsafe.BitCast<T, short>(value0),
989Unsafe.BitCast<T, short>(value1),
1048ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1049Unsafe.BitCast<T, byte>(value0),
1050Unsafe.BitCast<T, byte>(value1),
1051Unsafe.BitCast<T, byte>(value2),
1057ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1058Unsafe.BitCast<T, short>(value0),
1059Unsafe.BitCast<T, short>(value1),
1060Unsafe.BitCast<T, short>(value2),
1089ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1090Unsafe.BitCast<T, byte>(value0),
1091Unsafe.BitCast<T, byte>(value1),
1092Unsafe.BitCast<T, byte>(value2),
1098ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1099Unsafe.BitCast<T, short>(value0),
1100Unsafe.BitCast<T, short>(value1),
1101Unsafe.BitCast<T, short>(value2),
1151ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1152Unsafe.BitCast<T, byte>(value0),
1153Unsafe.BitCast<T, byte>(value1),
1154Unsafe.BitCast<T, byte>(value2),
1155Unsafe.BitCast<T, byte>(value3),
1161ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1162Unsafe.BitCast<T, short>(value0),
1163Unsafe.BitCast<T, short>(value1),
1164Unsafe.BitCast<T, short>(value2),
1165Unsafe.BitCast<T, short>(value3),
1208ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values));
1211ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1213Unsafe.Add(ref valuesRef, 1),
1214Unsafe.Add(ref valuesRef, 2),
1215Unsafe.Add(ref valuesRef, 3),
1216Unsafe.Add(ref valuesRef, 4),
1221ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values));
1224ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1226Unsafe.Add(ref valuesRef, 1),
1227Unsafe.Add(ref valuesRef, 2),
1228Unsafe.Add(ref valuesRef, 3),
1229Unsafe.Add(ref valuesRef, 4),
1237ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
1239ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)),
1392ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1393Unsafe.BitCast<T, byte>(value),
1399ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1400Unsafe.BitCast<T, short>(value),
1406ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
1407Unsafe.BitCast<T, int>(value),
1413ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
1414Unsafe.BitCast<T, long>(value),
1441ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1442Unsafe.BitCast<T, byte>(value),
1448ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1449Unsafe.BitCast<T, short>(value),
1455ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
1456Unsafe.BitCast<T, int>(value),
1462ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
1463Unsafe.BitCast<T, long>(value),
1519ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1520Unsafe.BitCast<T, byte>(value0),
1521Unsafe.BitCast<T, byte>(value1),
1527ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1528Unsafe.BitCast<T, short>(value0),
1529Unsafe.BitCast<T, short>(value1),
1557ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1558Unsafe.BitCast<T, byte>(value0),
1559Unsafe.BitCast<T, byte>(value1),
1565ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1566Unsafe.BitCast<T, short>(value0),
1567Unsafe.BitCast<T, short>(value1),
1626ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1627Unsafe.BitCast<T, byte>(value0),
1628Unsafe.BitCast<T, byte>(value1),
1629Unsafe.BitCast<T, byte>(value2),
1635ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1636Unsafe.BitCast<T, short>(value0),
1637Unsafe.BitCast<T, short>(value1),
1638Unsafe.BitCast<T, short>(value2),
1667ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1668Unsafe.BitCast<T, byte>(value0),
1669Unsafe.BitCast<T, byte>(value1),
1670Unsafe.BitCast<T, byte>(value2),
1676ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1677Unsafe.BitCast<T, short>(value0),
1678Unsafe.BitCast<T, short>(value1),
1679Unsafe.BitCast<T, short>(value2),
1730ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1731Unsafe.BitCast<T, byte>(value0),
1732Unsafe.BitCast<T, byte>(value1),
1733Unsafe.BitCast<T, byte>(value2),
1734Unsafe.BitCast<T, byte>(value3),
1740ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1741Unsafe.BitCast<T, short>(value0),
1742Unsafe.BitCast<T, short>(value1),
1743Unsafe.BitCast<T, short>(value2),
1744Unsafe.BitCast<T, short>(value3),
1788ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values));
1791ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1793Unsafe.Add(ref valuesRef, 1),
1794Unsafe.Add(ref valuesRef, 2),
1795Unsafe.Add(ref valuesRef, 3),
1796Unsafe.Add(ref valuesRef, 4),
1801ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values));
1804ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
1806Unsafe.Add(ref valuesRef, 1),
1807Unsafe.Add(ref valuesRef, 2),
1808Unsafe.Add(ref valuesRef, 3),
1809Unsafe.Add(ref valuesRef, 4),
1817ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
1819ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)),
1920ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1921Unsafe.BitCast<T, byte>(lowInclusive),
1922Unsafe.BitCast<T, byte>(highInclusive),
1929ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)),
1930Unsafe.BitCast<T, ushort>(lowInclusive),
1931Unsafe.BitCast<T, ushort>(highInclusive),
1938ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)),
1939Unsafe.BitCast<T, uint>(lowInclusive),
1940Unsafe.BitCast<T, uint>(highInclusive),
1947ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)),
1948Unsafe.BitCast<T, ulong>(lowInclusive),
1949Unsafe.BitCast<T, ulong>(highInclusive),
1985ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
1986Unsafe.BitCast<T, byte>(lowInclusive),
1987Unsafe.BitCast<T, byte>(highInclusive),
1994ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)),
1995Unsafe.BitCast<T, ushort>(lowInclusive),
1996Unsafe.BitCast<T, ushort>(highInclusive),
2003ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)),
2004Unsafe.BitCast<T, uint>(lowInclusive),
2005Unsafe.BitCast<T, uint>(highInclusive),
2012ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)),
2013Unsafe.BitCast<T, ulong>(lowInclusive),
2014Unsafe.BitCast<T, ulong>(highInclusive),
2050ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2051Unsafe.BitCast<T, byte>(lowInclusive),
2052Unsafe.BitCast<T, byte>(highInclusive),
2059ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)),
2060Unsafe.BitCast<T, ushort>(lowInclusive),
2061Unsafe.BitCast<T, ushort>(highInclusive),
2068ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)),
2069Unsafe.BitCast<T, uint>(lowInclusive),
2070Unsafe.BitCast<T, uint>(highInclusive),
2077ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)),
2078Unsafe.BitCast<T, ulong>(lowInclusive),
2079Unsafe.BitCast<T, ulong>(highInclusive),
2115ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2116Unsafe.BitCast<T, byte>(lowInclusive),
2117Unsafe.BitCast<T, byte>(highInclusive),
2124ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)),
2125Unsafe.BitCast<T, ushort>(lowInclusive),
2126Unsafe.BitCast<T, ushort>(highInclusive),
2133ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)),
2134Unsafe.BitCast<T, uint>(lowInclusive),
2135Unsafe.BitCast<T, uint>(highInclusive),
2142ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)),
2143Unsafe.BitCast<T, ulong>(lowInclusive),
2144Unsafe.BitCast<T, ulong>(highInclusive),
2188ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2189Unsafe.BitCast<T, byte>(value),
2194ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2195Unsafe.BitCast<T, short>(value),
2200ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
2201Unsafe.BitCast<T, int>(value),
2206ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
2207Unsafe.BitCast<T, long>(value),
2229ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2230Unsafe.BitCast<T, byte>(value),
2235ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2236Unsafe.BitCast<T, short>(value),
2241ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
2242Unsafe.BitCast<T, int>(value),
2247ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
2248Unsafe.BitCast<T, long>(value),
2297ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2299ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)),
2304ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
2306ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)),
2326ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2328ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)),
2333ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
2335ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)),
2384ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2385Unsafe.BitCast<T, byte>(value),
2391ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2392Unsafe.BitCast<T, short>(value),
2398ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
2399Unsafe.BitCast<T, int>(value),
2405ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
2406Unsafe.BitCast<T, long>(value),
2430ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2431Unsafe.BitCast<T, byte>(value),
2437ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2438Unsafe.BitCast<T, short>(value),
2444ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
2445Unsafe.BitCast<T, int>(value),
2451ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
2452Unsafe.BitCast<T, long>(value),
2504ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2506ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)),
2512ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
2514ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)),
2536ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2538ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)),
2544ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
2546ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)),
2647ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2648Unsafe.BitCast<T, byte>(value0),
2649Unsafe.BitCast<T, byte>(value1),
2655ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2656Unsafe.BitCast<T, short>(value0),
2657Unsafe.BitCast<T, short>(value1),
2682ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2683Unsafe.BitCast<T, byte>(value0),
2684Unsafe.BitCast<T, byte>(value1),
2690ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2691Unsafe.BitCast<T, short>(value0),
2692Unsafe.BitCast<T, short>(value1),
2747ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2748Unsafe.BitCast<T, byte>(value0),
2749Unsafe.BitCast<T, byte>(value1),
2750Unsafe.BitCast<T, byte>(value2),
2756ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2757Unsafe.BitCast<T, short>(value0),
2758Unsafe.BitCast<T, short>(value1),
2759Unsafe.BitCast<T, short>(value2),
2785ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
2786Unsafe.BitCast<T, byte>(value0),
2787Unsafe.BitCast<T, byte>(value1),
2788Unsafe.BitCast<T, byte>(value2),
2794ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
2795Unsafe.BitCast<T, short>(value0),
2796Unsafe.BitCast<T, short>(value1),
2797Unsafe.BitCast<T, short>(value2),
2851ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span));
2852ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values));
2865Unsafe.Add(ref valueRef, 1),
2872Unsafe.Add(ref valueRef, 1),
2873Unsafe.Add(ref valueRef, 2),
2880Unsafe.Add(ref valueRef, 1),
2881Unsafe.Add(ref valueRef, 2),
2882Unsafe.Add(ref valueRef, 3),
2889Unsafe.Add(ref valueRef, 1),
2890Unsafe.Add(ref valueRef, 2),
2891Unsafe.Add(ref valueRef, 3),
2892Unsafe.Add(ref valueRef, 4),
2899ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span));
2900ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values));
2908Unsafe.Add(ref valueRef, 1),
2913Unsafe.Add(ref valueRef, 1),
2914Unsafe.Add(ref valueRef, 2),
2919Unsafe.Add(ref valueRef, 1),
2920Unsafe.Add(ref valueRef, 2),
2921Unsafe.Add(ref valueRef, 3),
2926Unsafe.Add(ref valueRef, 1),
2927Unsafe.Add(ref valueRef, 2),
2928Unsafe.Add(ref valueRef, 3),
2929Unsafe.Add(ref valueRef, 4),
2931_ => ProbabilisticMap.IndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length),
3067ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3068Unsafe.BitCast<T, byte>(value0),
3069Unsafe.BitCast<T, byte>(value1),
3075ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
3076Unsafe.BitCast<T, short>(value0),
3077Unsafe.BitCast<T, short>(value1),
3102ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3103Unsafe.BitCast<T, byte>(value0),
3104Unsafe.BitCast<T, byte>(value1),
3110ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
3111Unsafe.BitCast<T, short>(value0),
3112Unsafe.BitCast<T, short>(value1),
3168ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3169Unsafe.BitCast<T, byte>(value0),
3170Unsafe.BitCast<T, byte>(value1),
3171Unsafe.BitCast<T, byte>(value2),
3177ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
3178Unsafe.BitCast<T, short>(value0),
3179Unsafe.BitCast<T, short>(value1),
3180Unsafe.BitCast<T, short>(value2),
3206ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3207Unsafe.BitCast<T, byte>(value0),
3208Unsafe.BitCast<T, byte>(value1),
3209Unsafe.BitCast<T, byte>(value2),
3215ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
3216Unsafe.BitCast<T, short>(value0),
3217Unsafe.BitCast<T, short>(value1),
3218Unsafe.BitCast<T, short>(value2),
3273ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span));
3274ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values));
3287Unsafe.Add(ref valueRef, 1),
3294Unsafe.Add(ref valueRef, 1),
3295Unsafe.Add(ref valueRef, 2),
3302Unsafe.Add(ref valueRef, 1),
3303Unsafe.Add(ref valueRef, 2),
3304Unsafe.Add(ref valueRef, 3),
3311Unsafe.Add(ref valueRef, 1),
3312Unsafe.Add(ref valueRef, 2),
3313Unsafe.Add(ref valueRef, 3),
3314Unsafe.Add(ref valueRef, 4),
3321ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span));
3322ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values));
3330Unsafe.Add(ref valueRef, 1),
3335Unsafe.Add(ref valueRef, 1),
3336Unsafe.Add(ref valueRef, 2),
3341Unsafe.Add(ref valueRef, 1),
3342Unsafe.Add(ref valueRef, 2),
3343Unsafe.Add(ref valueRef, 3),
3348Unsafe.Add(ref valueRef, 1),
3349Unsafe.Add(ref valueRef, 2),
3350Unsafe.Add(ref valueRef, 3),
3351Unsafe.Add(ref valueRef, 4),
3353_ => ProbabilisticMap.LastIndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length),
3428ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3429ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
3470ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3471ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
3512ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3514ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
3519ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
3521ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)),
3568ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
3569ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)),
3609ref Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */)),
3610ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)),
3616ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */),
4097nint byteOffset = Unsafe.ByteOffset(
4116nint byteOffset = Unsafe.ByteOffset(
4429ref byte src = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span));
4433Unsafe.BitCast<T, byte>(oldValue),
4434Unsafe.BitCast<T, byte>(newValue),
4441ref ushort src = ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span));
4445Unsafe.BitCast<T, ushort>(oldValue),
4446Unsafe.BitCast<T, ushort>(newValue),
4452ref int src = ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span));
4456Unsafe.BitCast<T, int>(oldValue),
4457Unsafe.BitCast<T, int>(newValue),
4463ref long src = ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span));
4467Unsafe.BitCast<T, long>(oldValue),
4468Unsafe.BitCast<T, long>(newValue),
4495ref byte src = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span));
4499Unsafe.BitCast<T, byte>(oldValue),
4500Unsafe.BitCast<T, byte>(newValue),
4507ref ushort src = ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span));
4511Unsafe.BitCast<T, ushort>(oldValue),
4512Unsafe.BitCast<T, ushort>(newValue),
4518ref int src = ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span));
4522Unsafe.BitCast<T, int>(oldValue),
4523Unsafe.BitCast<T, int>(newValue),
4529ref long src = ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span));
4533Unsafe.BitCast<T, long>(oldValue),
4534Unsafe.BitCast<T, long>(newValue),
4596nint byteOffset = Unsafe.ByteOffset(ref src, ref dst);
4609ref Unsafe.As<T, byte>(ref src),
4610ref Unsafe.As<T, byte>(ref dst),
4611Unsafe.BitCast<T, byte>(oldValue),
4612Unsafe.BitCast<T, byte>(newValue),
4620ref Unsafe.As<T, ushort>(ref src),
4621ref Unsafe.As<T, ushort>(ref dst),
4622Unsafe.BitCast<T, ushort>(oldValue),
4623Unsafe.BitCast<T, ushort>(newValue),
4630ref Unsafe.As<T, int>(ref src),
4631ref Unsafe.As<T, int>(ref dst),
4632Unsafe.BitCast<T, int>(oldValue),
4633Unsafe.BitCast<T, int>(newValue),
4640ref Unsafe.As<T, long>(ref src),
4641ref Unsafe.As<T, long>(ref dst),
4642Unsafe.BitCast<T, long>(oldValue),
4643Unsafe.BitCast<T, long>(newValue),
4680nint byteOffset = Unsafe.ByteOffset(ref src, ref dst);
4695ref Unsafe.As<T, byte>(ref src),
4696ref Unsafe.As<T, byte>(ref dst),
4697Unsafe.BitCast<T, byte>(oldValue),
4698Unsafe.BitCast<T, byte>(newValue),
4706ref Unsafe.As<T, ushort>(ref src),
4707ref Unsafe.As<T, ushort>(ref dst),
4708Unsafe.BitCast<T, ushort>(oldValue),
4709Unsafe.BitCast<T, ushort>(newValue),
4716ref Unsafe.As<T, int>(ref src),
4717ref Unsafe.As<T, int>(ref dst),
4718Unsafe.BitCast<T, int>(oldValue),
4719Unsafe.BitCast<T, int>(newValue),
4726ref Unsafe.As<T, long>(ref src),
4727ref Unsafe.As<T, long>(ref dst),
4728Unsafe.BitCast<T, long>(oldValue),
4729Unsafe.BitCast<T, long>(newValue),
4779if (!Unsafe.AreSame(ref source._reference, ref destination._reference) &&
4829if (!Unsafe.AreSame(ref source._reference, ref destination._reference) &&
4888ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
4889ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
5382ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
5383Unsafe.BitCast<T, byte>(value),
5389ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
5390Unsafe.BitCast<T, short>(value),
5396ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
5397Unsafe.BitCast<T, int>(value),
5403ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
5404Unsafe.BitCast<T, long>(value),
5431ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
5432Unsafe.BitCast<T, byte>(value),
5438ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)),
5439Unsafe.BitCast<T, short>(value),
5445ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)),
5446Unsafe.BitCast<T, int>(value),
5452ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
5453Unsafe.BitCast<T, long>(value),
5878_searchValues = Unsafe.As<SearchValues<T>>(string.SearchValuesStorage.WhiteSpaceChars);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (8)
617if (source.TryCopyTo(Unsafe.BitCast<Span<TChar>, Span<char>>(destination)))
628return Encoding.UTF8.TryGetBytes(source, Unsafe.BitCast<Span<TChar>, Span<byte>>(destination), out charsWritten);
1573Unsafe.CopyBlockUnaligned(
1575ref Unsafe.Add(ref MemoryMarshal.GetReference(typeof(TChar) == typeof(char) ? TwoDigitsCharsAsBytes : TwoDigitsBytes), (uint)sizeof(TChar) * 2 * value),
1593Unsafe.CopyBlockUnaligned(
1595ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * value),
1598Unsafe.CopyBlockUnaligned(
1600ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * remainder),
src\libraries\System.Private.CoreLib\src\System\Number.Parsing.cs (13)
898ReadOnlySpan<char> typedSpan = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<char>>(span);
899ReadOnlySpan<char> typedValue = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<char>>(value);
906ReadOnlySpan<byte> typedSpan = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<byte>>(span);
907ReadOnlySpan<byte> typedValue = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<byte>>(value);
918return Unsafe.BitCast<ReadOnlySpan<char>, ReadOnlySpan<TChar>>(Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<char>>(span).Trim());
924return Unsafe.BitCast<ReadOnlySpan<byte>, ReadOnlySpan<TChar>>(Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<byte>>(span).TrimUtf8());
934ReadOnlySpan<char> typedSpan = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<char>>(span);
935ReadOnlySpan<char> typedValue = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<char>>(value);
942ReadOnlySpan<byte> typedSpan = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<byte>>(span);
943ReadOnlySpan<byte> typedValue = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<byte>>(value);
1056ReadOnlySpan<byte> bytes = Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<byte>>(value);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector.cs (92)
44Unsafe.SkipInit(out Vector<T> result);
71Unsafe.SkipInit(out Vector<T> result);
155return Unsafe.BitCast<Vector<TFrom>, Vector<TTo>>(vector);
298Unsafe.SkipInit(out Vector<T> result);
318Unsafe.SkipInit(out Vector<double> result);
337Unsafe.SkipInit(out Vector<float> result);
444Unsafe.SkipInit(out Vector<int> result);
461Unsafe.SkipInit(out Vector<int> result);
478Unsafe.SkipInit(out Vector<long> result);
495Unsafe.SkipInit(out Vector<long> result);
512Unsafe.SkipInit(out Vector<float> result);
553Unsafe.SkipInit(out Vector<uint> result);
571Unsafe.SkipInit(out Vector<uint> result);
589Unsafe.SkipInit(out Vector<ulong> result);
607Unsafe.SkipInit(out Vector<ulong> result);
621Unsafe.SkipInit(out Vector<T> result);
679Unsafe.SkipInit(out Vector<T> result);
740Unsafe.SkipInit(out Vector<T> result);
763return Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
792Unsafe.SkipInit(out Vector<T> result);
810Unsafe.SkipInit(out Vector<T> result);
884Unsafe.SkipInit(out Vector<T> result);
954Unsafe.SkipInit(out Vector<T> result);
1015Unsafe.SkipInit(out Vector<T> result);
1035Unsafe.SkipInit(out Vector<double> result);
1054Unsafe.SkipInit(out Vector<float> result);
1078Unsafe.SkipInit(out Vector<double> result);
1102Unsafe.SkipInit(out Vector<float> result);
1141Unsafe.SkipInit(out Vector<T> result);
1229Unsafe.SkipInit(out Vector<T> result);
1311Unsafe.SkipInit(out Vector<T> result);
1638Unsafe.SkipInit(out Vector<T> result);
1696Unsafe.SkipInit(out Vector<T> result);
1784Unsafe.SkipInit(out Vector<T> result);
1912ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source));
1913return Unsafe.ReadUnaligned<Vector<T>>(in address);
1928ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset));
1929return Unsafe.ReadUnaligned<Vector<T>>(in address);
1935Unsafe.SkipInit(out Vector<T> result);
1977Unsafe.SkipInit(out Vector<T> result);
2027Unsafe.SkipInit(out Vector<T> result);
2050Unsafe.SkipInit(out Vector<T> result);
2073Unsafe.SkipInit(out Vector<T> result);
2096Unsafe.SkipInit(out Vector<T> result);
2119Unsafe.SkipInit(out Vector<T> result);
2142Unsafe.SkipInit(out Vector<T> result);
2165Unsafe.SkipInit(out Vector<T> result);
2188Unsafe.SkipInit(out Vector<T> result);
2211Unsafe.SkipInit(out Vector<T> result);
2234Unsafe.SkipInit(out Vector<T> result);
2274Unsafe.SkipInit(out Vector<T> result);
2290Unsafe.SkipInit(out Vector<double> result);
2306Unsafe.SkipInit(out Vector<float> result);
2323Unsafe.SkipInit(out Vector<TResult> result);
2392Unsafe.SkipInit(out Vector<TResult> result);
2496Unsafe.SkipInit(out Vector<T> result);
2554Unsafe.SkipInit(out Vector<T> result);
2807Unsafe.SkipInit(out Vector<T> result);
2849Unsafe.SkipInit(out Vector<T> sinResult);
2850Unsafe.SkipInit(out Vector<T> cosResult);
2898Unsafe.SkipInit(out Vector<T> result);
2958ref byte address = ref Unsafe.As<T, byte>(ref destination);
2959Unsafe.WriteUnaligned(ref address, source);
2974destination = ref Unsafe.Add(ref destination, (nint)elementOffset);
2975Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source);
2993Unsafe.SkipInit(out Vector<T> result);
3053Unsafe.SkipInit(out Vector<T> result);
3204Unsafe.SkipInit(out Vector<ushort> lower);
3222Unsafe.SkipInit(out Vector<int> lower);
3240Unsafe.SkipInit(out Vector<long> lower);
3259Unsafe.SkipInit(out Vector<short> lower);
3277Unsafe.SkipInit(out Vector<double> lower);
3296Unsafe.SkipInit(out Vector<uint> lower);
3315Unsafe.SkipInit(out Vector<ulong> lower);
3334Unsafe.SkipInit(out Vector<ushort> upper);
3352Unsafe.SkipInit(out Vector<int> upper);
3370Unsafe.SkipInit(out Vector<long> upper);
3389Unsafe.SkipInit(out Vector<short> upper);
3407Unsafe.SkipInit(out Vector<double> upper);
3426Unsafe.SkipInit(out Vector<uint> upper);
3445Unsafe.SkipInit(out Vector<ulong> upper);
3489ref T address = ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in vector));
3490return Unsafe.Add(ref address, index);
3497ref T address = ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in vector));
3498Unsafe.Add(ref address, index) = value;
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector_1.cs (30)
61this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref values[0]));
80this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref values[index]));
97this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
115this = Unsafe.ReadUnaligned<Vector<T>>(ref MemoryMarshal.GetReference(values));
156Unsafe.SkipInit(out Vector<T> result);
228Unsafe.SkipInit(out Vector<T> result);
248Unsafe.SkipInit(out Vector<ulong> result);
271Unsafe.SkipInit(out Vector<ulong> result);
293Unsafe.SkipInit(out Vector<T> result);
312Unsafe.SkipInit(out Vector<T> result);
350Unsafe.SkipInit(out Vector<ulong> result);
468Unsafe.SkipInit(out Vector<T> result);
487Unsafe.SkipInit(out Vector<T> result);
520Unsafe.SkipInit(out Vector<ulong> result);
541Unsafe.SkipInit(out Vector<T> result);
560Unsafe.SkipInit(out Vector<T> result);
611Unsafe.SkipInit(out Vector<T> result);
636Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), this);
660Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), this);
676Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this);
690Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this);
797Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), this);
812Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (17)
411return Unsafe.ReadUnaligned<Vector2>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values)));
704ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.AsRef(in source));
705return Unsafe.ReadUnaligned<Vector2>(in address);
714ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset));
715return Unsafe.ReadUnaligned<Vector2>(in address);
974Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[0]), this);
1002Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[index]), this);
1016Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
1030Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (17)
446return Unsafe.ReadUnaligned<Vector3>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values)));
737ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.AsRef(in source));
738return Unsafe.ReadUnaligned<Vector3>(in address);
747ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset));
748return Unsafe.ReadUnaligned<Vector3>(in address);
987Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[0]), this);
1015Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[index]), this);
1029Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
1043Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
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\ReadOnlySpan.cs (9)
83_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */);
119_reference = ref Unsafe.AsRef(in reference);
150return ref Unsafe.Add(ref _reference, (nint)(uint)index /* force zero-extension */);
227return new ReadOnlySpan<T>(ref Unsafe.As<TDerived, T>(ref items._reference), items.Length);
292ref T ret = ref Unsafe.NullRef<T>();
348Unsafe.AreSame(ref left._reference, ref right._reference);
358return new string(new ReadOnlySpan<char>(ref Unsafe.As<T, char>(ref _reference), _length));
376return new ReadOnlySpan<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), _length - start);
399return new ReadOnlySpan<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), length);
src\libraries\System.Private.CoreLib\src\System\Reflection\FieldAccessor.cs (30)
131return Volatile.Read(ref Unsafe.As<byte, object>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)));
142ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset));
148(void*)Unsafe.As<byte, IntPtr>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)),
152return Volatile.Read(ref Unsafe.As<IntPtr, object>(ref *(IntPtr*)_addressOrOffset));
159return RuntimeHelpers.Box(_methodTable, ref Unsafe.AsRef<byte>(_addressOrOffset.ToPointer()));
165ref Unsafe.As<IntPtr, object>(ref *(IntPtr*)_addressOrOffset).GetRawData());
168return Pointer.Box((void*)Unsafe.As<byte, IntPtr>(
169ref Unsafe.AsRef<byte>(_addressOrOffset.ToPointer())), _fieldInfo.FieldType);
223ref Unsafe.As<byte, object?>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)),
231ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset),
239ref Unsafe.As<byte, short>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)),
240Unsafe.As<byte, short>(ref value!.GetRawData()));
247ref Unsafe.As<byte, int>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)),
248Unsafe.As<byte, int>(ref value!.GetRawData()));
255ref Unsafe.As<byte, long>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)),
256Unsafe.As<byte, long>(ref value!.GetRawData()));
261Volatile.Write(ref Unsafe.As<IntPtr, object?>(ref *(IntPtr*)_addressOrOffset), value);
267ref Unsafe.AsRef<byte>(_addressOrOffset.ToPointer()),
274ref Unsafe.AsRef<short>(_addressOrOffset.ToPointer()),
275Unsafe.As<byte, short>(ref value!.GetRawData()));
281ref Unsafe.AsRef<int>(_addressOrOffset.ToPointer()),
282Unsafe.As<byte, int>(ref value!.GetRawData()));
288ref Unsafe.AsRef<long>(_addressOrOffset.ToPointer()),
289Unsafe.As<byte, long>(ref value!.GetRawData()));
src\libraries\System.Private.CoreLib\src\System\Reflection\InvokeUtils.cs (55)
138Unsafe.As<byte, ushort>(ref destElement) = srcElement; break;
141Unsafe.As<byte, uint>(ref destElement) = srcElement; break;
144Unsafe.As<byte, ulong>(ref destElement) = srcElement; break;
146Unsafe.As<byte, float>(ref destElement) = srcElement; break;
148Unsafe.As<byte, double>(ref destElement) = srcElement; break;
158Unsafe.As<byte, short>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break;
160Unsafe.As<byte, int>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break;
162Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break;
164Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break;
166Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break;
179Unsafe.As<byte, ushort>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break;
182Unsafe.As<byte, uint>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break;
185Unsafe.As<byte, ulong>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break;
187Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break;
189Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break;
199Unsafe.As<byte, int>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break;
201Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break;
203Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break;
205Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break;
216Unsafe.As<byte, ulong>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break;
218Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break;
220Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break;
230Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break;
232Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break;
234Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break;
244Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, ulong>(ref srcElement); break;
246Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, ulong>(ref srcElement); break;
256Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, long>(ref srcElement); break;
258Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, long>(ref srcElement); break;
266Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, float>(ref srcElement); break;
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\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\MemoryMarshal.cs (19)
37ref Unsafe.As<T, byte>(ref GetReference(span)),
60ref Unsafe.As<T, byte>(ref GetReference(span)),
93internal 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);
100internal 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);
153ref Unsafe.As<TFrom, TTo>(ref span._reference),
208ref Unsafe.As<TFrom, TTo>(ref GetReference(span)),
227new Span<T>(ref Unsafe.AsRef(in reference), length);
244new ReadOnlySpan<T>(ref Unsafe.AsRef(in reference), length);
290segment = new ArraySegment<T>(Unsafe.As<T[]>(obj), index & ReadOnlyMemory<T>.RemoveFlagsBitMask, length);
299if (Unsafe.As<MemoryManager<T>>(obj).TryGetArray(out ArraySegment<T> tempArraySegment))
411T[] array = Unsafe.As<T[]>(obj);
479return Unsafe.ReadUnaligned<T>(ref GetReference(source));
499value = Unsafe.ReadUnaligned<T>(ref GetReference(source));
518Unsafe.WriteUnaligned(ref GetReference(destination), value);
537Unsafe.WriteUnaligned(ref GetReference(destination), value);
560return ref Unsafe.As<byte, T>(ref GetReference(span));
582return 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));
1052Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent);
1076Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), exponent);
1100Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand);
1124Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), significand);
1922Unsafe.SkipInit(out result);
1923return NativeType.TryParse(utf8Text, style, provider, out Unsafe.As<NFloat, NativeType>(ref result));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (56)
183return Unsafe.BitCast<Vector128<TFrom>, Vector128<TTo>>(vector);
568Unsafe.SkipInit(out Vector128<float> result);
679Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector);
706Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector);
723Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
907return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref values[0]));
928return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref values[index]));
945return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
1172Unsafe.SkipInit(out Vector128<T> result);
1358Unsafe.SkipInit(out Vector128<T> result);
2279ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source));
2280return Unsafe.ReadUnaligned<Vector128<T>>(in address);
2295ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset));
2296return Unsafe.ReadUnaligned<Vector128<T>>(in address);
2302internal static Vector128<ushort> LoadUnsafe(ref char source) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source));
2308internal static Vector128<ushort> LoadUnsafe(ref char source, nuint elementOffset) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset);
2623Unsafe.SkipInit(out Vector128<TResult> result);
2720Unsafe.SkipInit(out Vector128<TResult> result);
3240Unsafe.SkipInit(out Vector128<byte> result);
3285Unsafe.SkipInit(out Vector128<sbyte> result);
3362Unsafe.SkipInit(out Vector128<short> result);
3387Unsafe.SkipInit(out Vector128<ushort> result);
3450Unsafe.SkipInit(out Vector128<int> result);
3475Unsafe.SkipInit(out Vector128<uint> result);
3499Unsafe.SkipInit(out Vector128<float> result);
3581Unsafe.SkipInit(out Vector128<long> result);
3606Unsafe.SkipInit(out Vector128<ulong> result);
3630Unsafe.SkipInit(out Vector128<double> result);
3859ref byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref destination, elementOffset));
3860Unsafe.WriteUnaligned(ref address, source.AsDouble().ToScalar());
3873ref byte address = ref Unsafe.As<T, byte>(ref destination);
3874Unsafe.WriteUnaligned(ref address, source);
3889destination = ref Unsafe.Add(ref destination, (nint)elementOffset);
3890Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source);
3985Unsafe.SkipInit(out Vector256<T> result);
4038Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
4375ref T address = ref Unsafe.As<Vector128<T>, T>(ref Unsafe.AsRef(in vector));
4376return Unsafe.Add(ref address, index);
4383ref T address = ref Unsafe.As<Vector128<T>, T>(ref Unsafe.AsRef(in vector));
4384Unsafe.Add(ref address, index) = value;
4388internal static void SetLowerUnsafe<T>(in this Vector128<T> vector, Vector64<T> value) => Unsafe.AsRef(in vector._lower) = value;
4391internal static void SetUpperUnsafe<T>(in this Vector128<T> vector, Vector64<T> value) => Unsafe.AsRef(in vector._upper) = value;
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.Numerics.cs (20)
61return Unsafe.BitCast<Vector128<float>, Plane>(value);
74return Unsafe.BitCast<Vector128<float>, Quaternion>(value);
87return Unsafe.BitCast<Plane, Vector128<float>>(value);
100return Unsafe.BitCast<Quaternion, Vector128<float>>(value);
125return Unsafe.BitCast<Vector4, Vector128<float>>(value);
141ref byte address = ref Unsafe.As<Vector<T>, byte>(ref value);
142return Unsafe.ReadUnaligned<Vector128<T>>(ref address);
154Unsafe.SkipInit(out Vector128<float> result);
155Unsafe.WriteUnaligned(ref Unsafe.As<Vector128<float>, byte>(ref result), value);
168Unsafe.SkipInit(out Vector128<float> result);
169Unsafe.WriteUnaligned(ref Unsafe.As<Vector128<float>, byte>(ref result), value);
180ref byte address = ref Unsafe.As<Vector128<float>, byte>(ref value);
181return Unsafe.ReadUnaligned<Vector2>(ref address);
191ref byte address = ref Unsafe.As<Vector128<float>, byte>(ref value);
192return Unsafe.ReadUnaligned<Vector3>(ref address);
204return Unsafe.BitCast<Vector128<float>, Vector4>(value);
221Unsafe.WriteUnaligned(ref Unsafe.As<Vector<T>, byte>(ref result), value);
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 (60)
177return Unsafe.BitCast<Vector256<TFrom>, Vector256<TTo>>(vector);
295ref byte address = ref Unsafe.As<Vector<T>, byte>(ref value);
296return Unsafe.ReadUnaligned<Vector256<T>>(ref address);
301Unsafe.WriteUnaligned(ref Unsafe.As<Vector256<T>, byte>(ref result), value);
319ref byte address = ref Unsafe.As<Vector256<T>, byte>(ref value);
320return Unsafe.ReadUnaligned<Vector<T>>(ref address);
325Unsafe.WriteUnaligned(ref Unsafe.As<Vector<T>, byte>(ref result), value);
695Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector);
722Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector);
739Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
923return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref values[0]));
944return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref values[index]));
961return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
1265Unsafe.SkipInit(out Vector256<T> result);
1453Unsafe.SkipInit(out Vector256<T> result);
2372ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source));
2373return Unsafe.ReadUnaligned<Vector256<T>>(in address);
2388ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset));
2389return Unsafe.ReadUnaligned<Vector256<T>>(in address);
2395internal static Vector256<ushort> LoadUnsafe(ref char source) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source));
2401internal static Vector256<ushort> LoadUnsafe(ref char source, nuint elementOffset) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset);
2716Unsafe.SkipInit(out Vector256<TResult> result);
2785Unsafe.SkipInit(out Vector256<TResult> result);
3264Unsafe.SkipInit(out Vector256<byte> result);
3289Unsafe.SkipInit(out Vector256<sbyte> result);
3354Unsafe.SkipInit(out Vector256<short> result);
3379Unsafe.SkipInit(out Vector256<ushort> result);
3442Unsafe.SkipInit(out Vector256<int> result);
3467Unsafe.SkipInit(out Vector256<uint> result);
3491Unsafe.SkipInit(out Vector256<float> result);
3573Unsafe.SkipInit(out Vector256<long> result);
3598Unsafe.SkipInit(out Vector256<ulong> result);
3622Unsafe.SkipInit(out Vector256<double> result);
3849ref byte address = ref Unsafe.As<T, byte>(ref destination);
3850Unsafe.WriteUnaligned(ref address, source);
3865destination = ref Unsafe.Add(ref destination, (nint)elementOffset);
3866Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source);
3949Unsafe.SkipInit(out Vector512<T> result);
4002Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
4337ref T address = ref Unsafe.As<Vector256<T>, T>(ref Unsafe.AsRef(in vector));
4338return Unsafe.Add(ref address, index);
4345ref T address = ref Unsafe.As<Vector256<T>, T>(ref Unsafe.AsRef(in vector));
4346Unsafe.Add(ref address, index) = value;
4349internal static void SetLowerUnsafe<T>(in this Vector256<T> vector, Vector128<T> value) => Unsafe.AsRef(in vector._lower) = value;
4351internal static void SetUpperUnsafe<T>(in this Vector256<T> vector, Vector128<T> value) => Unsafe.AsRef(in vector._upper) = value;
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 (55)
176return Unsafe.BitCast<Vector512<TFrom>, Vector512<TTo>>(vector);
294Unsafe.WriteUnaligned(ref Unsafe.As<Vector512<T>, byte>(ref result), value);
310ref byte address = ref Unsafe.As<Vector512<T>, byte>(ref value);
311return Unsafe.ReadUnaligned<Vector<T>>(ref address);
607Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector);
633Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector);
649Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
825return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref values[0]));
845return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref values[index]));
862return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
1305Unsafe.SkipInit(out Vector512<T> result);
1492Unsafe.SkipInit(out Vector512<T> result);
2398ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source));
2399return Unsafe.ReadUnaligned<Vector512<T>>(in address);
2414ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset));
2415return Unsafe.ReadUnaligned<Vector512<T>>(in address);
2421internal static Vector512<ushort> LoadUnsafe(ref char source) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source));
2427internal static Vector512<ushort> LoadUnsafe(ref char source, nuint elementOffset) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset);
2741Unsafe.SkipInit(out Vector512<TResult> result);
2810Unsafe.SkipInit(out Vector512<TResult> result);
3289Unsafe.SkipInit(out Vector512<byte> result);
3314Unsafe.SkipInit(out Vector512<sbyte> result);
3379Unsafe.SkipInit(out Vector512<short> result);
3404Unsafe.SkipInit(out Vector512<ushort> result);
3467Unsafe.SkipInit(out Vector512<int> result);
3492Unsafe.SkipInit(out Vector512<uint> result);
3516Unsafe.SkipInit(out Vector512<float> result);
3598Unsafe.SkipInit(out Vector512<long> result);
3623Unsafe.SkipInit(out Vector512<ulong> result);
3647Unsafe.SkipInit(out Vector512<double> result);
3860ref byte address = ref Unsafe.As<T, byte>(ref destination);
3861Unsafe.WriteUnaligned(ref address, source);
3876destination = ref Unsafe.Add(ref destination, (nint)elementOffset);
3877Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source);
3979Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
4314ref T address = ref Unsafe.As<Vector512<T>, T>(ref Unsafe.AsRef(in vector));
4315return Unsafe.Add(ref address, index);
4322ref T address = ref Unsafe.As<Vector512<T>, T>(ref Unsafe.AsRef(in vector));
4323Unsafe.Add(ref address, index) = value;
4326internal static void SetLowerUnsafe<T>(in this Vector512<T> vector, Vector256<T> value) => Unsafe.AsRef(in vector._lower) = value;
4328internal static void SetUpperUnsafe<T>(in this Vector512<T> vector, Vector256<T> value) => Unsafe.AsRef(in vector._upper) = value;
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 (120)
46Unsafe.SkipInit(out Vector64<T> result);
73Unsafe.SkipInit(out Vector64<T> result);
176return Unsafe.BitCast<Vector64<TFrom>, Vector64<TTo>>(vector);
321Unsafe.SkipInit(out Vector64<T> result);
382Unsafe.SkipInit(out Vector64<double> result);
401Unsafe.SkipInit(out Vector64<double> result);
419Unsafe.SkipInit(out Vector64<int> result);
437Unsafe.SkipInit(out Vector64<int> result);
455Unsafe.SkipInit(out Vector64<long> result);
473Unsafe.SkipInit(out Vector64<long> result);
491Unsafe.SkipInit(out Vector64<float> result);
510Unsafe.SkipInit(out Vector64<float> result);
529Unsafe.SkipInit(out Vector64<uint> result);
548Unsafe.SkipInit(out Vector64<uint> result);
567Unsafe.SkipInit(out Vector64<ulong> result);
586Unsafe.SkipInit(out Vector64<ulong> result);
616Unsafe.SkipInit(out Vector64<T> result);
645Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector);
672Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector);
689Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
695Unsafe.SkipInit(out Vector64<T> result);
786Unsafe.SkipInit(out Vector64<T> result);
896return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref values[0]));
917return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref values[index]));
934return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)));
952Unsafe.SkipInit(out Vector64<byte> result);
975Unsafe.SkipInit(out Vector64<short> result);
992Unsafe.SkipInit(out Vector64<int> result);
1014Unsafe.SkipInit(out Vector64<sbyte> result);
1034Unsafe.SkipInit(out Vector64<float> result);
1052Unsafe.SkipInit(out Vector64<ushort> result);
1070Unsafe.SkipInit(out Vector64<uint> result);
1180Unsafe.SkipInit(out Vector64<T> result);
1275Unsafe.SkipInit(out Vector64<T> result);
1356Unsafe.SkipInit(out Vector64<T> result);
1400Unsafe.SkipInit(out Vector64<T> result);
1493Unsafe.SkipInit(out Vector64<T> result);
1532Unsafe.SkipInit(out Vector64<double> result);
1556Unsafe.SkipInit(out Vector64<float> result);
1596Unsafe.SkipInit(out Vector64<T> result);
1659Unsafe.SkipInit(out Vector64<T> result);
1715Unsafe.SkipInit(out Vector64<T> result);
2047Unsafe.SkipInit(out Vector64<T> result);
2106Unsafe.SkipInit(out Vector64<T> result);
2169Unsafe.SkipInit(out Vector64<T> result);
2271ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source));
2272return Unsafe.ReadUnaligned<Vector64<T>>(in address);
2287ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset));
2288return Unsafe.ReadUnaligned<Vector64<T>>(in address);
2294Unsafe.SkipInit(out Vector64<T> result);
2340Unsafe.SkipInit(out Vector64<T> result);
2394Unsafe.SkipInit(out Vector64<T> result);
2417Unsafe.SkipInit(out Vector64<T> result);
2440Unsafe.SkipInit(out Vector64<T> result);
2463Unsafe.SkipInit(out Vector64<T> result);
2486Unsafe.SkipInit(out Vector64<T> result);
2509Unsafe.SkipInit(out Vector64<T> result);
2532Unsafe.SkipInit(out Vector64<T> result);
2555Unsafe.SkipInit(out Vector64<T> result);
2578Unsafe.SkipInit(out Vector64<T> result);
2601Unsafe.SkipInit(out Vector64<T> result);
2644Unsafe.SkipInit(out Vector64<T> result);
2668Unsafe.SkipInit(out Vector64<double> result);
2692Unsafe.SkipInit(out Vector64<float> result);
2709Unsafe.SkipInit(out Vector64<TResult> result);
2778Unsafe.SkipInit(out Vector64<TResult> result);
2893Unsafe.SkipInit(out Vector64<T> result);
2957Unsafe.SkipInit(out Vector64<T> result);
3068Unsafe.SkipInit(out Vector64<uint> result);
3090Unsafe.SkipInit(out Vector64<ulong> result);
3281Unsafe.SkipInit(out Vector64<byte> result);
3306Unsafe.SkipInit(out Vector64<sbyte> result);
3371Unsafe.SkipInit(out Vector64<short> result);
3396Unsafe.SkipInit(out Vector64<ushort> result);
3459Unsafe.SkipInit(out Vector64<int> result);
3484Unsafe.SkipInit(out Vector64<uint> result);
3508Unsafe.SkipInit(out Vector64<float> result);
3586Unsafe.SkipInit(out Vector64<T> result);
3639Unsafe.SkipInit(out Vector64<T> sinResult);
3640Unsafe.SkipInit(out Vector64<T> cosResult);
3700Unsafe.SkipInit(out Vector64<T> result);
3760ref byte address = ref Unsafe.As<T, byte>(ref destination);
3761Unsafe.WriteUnaligned(ref address, source);
3776destination = ref Unsafe.Add(ref destination, (nint)elementOffset);
3777Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source);
3795Unsafe.SkipInit(out Vector64<T> result);
3868Unsafe.SkipInit(out Vector128<T> result);
3892Unsafe.SkipInit(out Vector64<T> result);
3926Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector);
3984Unsafe.SkipInit(out Vector64<ushort> lower);
4002Unsafe.SkipInit(out Vector64<int> lower);
4020Unsafe.SkipInit(out Vector64<long> lower);
4039Unsafe.SkipInit(out Vector64<short> lower);
4057Unsafe.SkipInit(out Vector64<double> lower);
4076Unsafe.SkipInit(out Vector64<uint> lower);
4095Unsafe.SkipInit(out Vector64<ulong> lower);
4114Unsafe.SkipInit(out Vector64<ushort> upper);
4132Unsafe.SkipInit(out Vector64<int> upper);
4150Unsafe.SkipInit(out Vector64<long> upper);
4169Unsafe.SkipInit(out Vector64<short> upper);
4187Unsafe.SkipInit(out Vector64<double> upper);
4206Unsafe.SkipInit(out Vector64<uint> upper);
4225Unsafe.SkipInit(out Vector64<ulong> upper);
4271ref T address = ref Unsafe.As<Vector64<T>, T>(ref Unsafe.AsRef(in vector));
4272return Unsafe.Add(ref address, index);
4279ref T address = ref Unsafe.As<Vector64<T>, T>(ref Unsafe.AsRef(in vector));
4280Unsafe.Add(ref address, index) = value;
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 (113)
78TVectorInt64 ux = Unsafe.BitCast<TVectorDouble, TVectorInt64>(ax);
113Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
119Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals((region + TVectorInt64.One) & TVectorInt64.Create(2), TVectorInt64.Zero)),
130Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.GreaterThan(ux, TVectorInt64.Create(ARG_SMALLER - 1))),
216TVectorInt32 ux = Unsafe.BitCast<TVectorSingle, TVectorInt32>(ax);
273Unsafe.BitCast<TVectorInt32, TVectorSingle>(TVectorInt32.GreaterThan(ux, TVectorInt32.Create(ARG_SMALLER - 1))),
287Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
293Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals((region + TVectorInt64.One) & TVectorInt64.Create(2), TVectorInt64.Zero)),
411if (TVectorUInt64.LessThanOrEqualAll(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(TVectorDouble.Abs(x)), TVectorUInt64.Create(V_ARG_MAX)))
417TVectorUInt64 n = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(dn);
454return poly * Unsafe.BitCast<TVectorUInt64, TVectorDouble>((n + TVectorUInt64.Create(V_DP64_BIAS)) << 52);
542if (TVectorUInt32.GreaterThanAny(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(TVectorSingle.Abs(x)), TVectorUInt32.Create(V_ARG_MAX)))
569TVectorUInt64 n = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(dn);
588return Unsafe.BitCast<TVectorUInt64, TVectorDouble>(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(poly) + (n << 52));
608TVectorUInt64 xBits = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(ax);
609TVectorUInt64 yBits = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(ay);
618TVectorDouble insignificanMask = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(
627TVectorDouble expFix = TVectorDouble.ConditionalSelect(Unsafe.BitCast<TVectorUInt64, TVectorDouble>(scaleDownMask), TVectorDouble.Create(4.149515568880993E+180), TVectorDouble.One);
633expFix = TVectorDouble.ConditionalSelect(Unsafe.BitCast<TVectorUInt64, TVectorDouble>(scaleUpMask), TVectorDouble.Create(2.409919865102884E-181), expFix);
648ax = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(xBits);
649ax -= subnormalFix & Unsafe.BitCast<TVectorUInt64, TVectorDouble>(xSubnormalMask);
653ay = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(yBits);
654ay -= subnormalFix & Unsafe.BitCast<TVectorUInt64, TVectorDouble>(ySubnormalMask);
656xBits = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(ax);
657yBits = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(ay);
667xBits = TVectorUInt64.ConditionalSelect(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(lessThanMask), yBits, xBits);
668yBits = TVectorUInt64.ConditionalSelect(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(lessThanMask), tmpBits, yBits);
675TVectorDouble xHead = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(xBits & headMask);
676TVectorDouble yHead = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(yBits & headMask);
698TVectorDouble equalExponentsMask = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(TVectorUInt64.IsZero(expDiff));
776TVectorUInt32 bits = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(TVectorSingle.Abs(vector));
793return Unsafe.BitCast<TVectorUInt32, TVectorSingle>(result);
801TVectorUInt64 bits = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(TVectorDouble.Abs(vector));
818return Unsafe.BitCast<TVectorUInt64, TVectorDouble>(result);
826TVectorUInt32 bits = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(TVectorSingle.Abs(vector));
839return Unsafe.BitCast<TVectorUInt32, TVectorSingle>(result);
847TVectorUInt64 bits = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(TVectorDouble.Abs(vector));
860return Unsafe.BitCast<TVectorUInt64, TVectorDouble>(result);
933TVectorUInt64 specialMask = TVectorUInt64.GreaterThanOrEqual(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_MIN), TVectorUInt64.Create(V_MAX - V_MIN));
962TVectorDouble subnormalMask = TVectorDouble.AndNot(Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask), temp);
967Unsafe.BitCast<TVectorUInt64, TVectorDouble>(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x * 4503599627370496.0) - TVectorUInt64.Create(52ul << 52)),
971specialMask = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(temp);
975TVectorUInt64 vx = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_OFF);
976TVectorDouble n = ConvertToDouble<TVectorInt64, TVectorDouble>(Unsafe.BitCast<TVectorUInt64, TVectorInt64>(vx) >> 52);
980TVectorDouble r = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(vx) - TVectorDouble.One;
1027Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask),
1114TVectorUInt32 specialMask = TVectorUInt32.GreaterThanOrEqual(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_MIN), TVectorUInt32.Create(V_MAX - V_MIN));
1143TVectorSingle subnormalMask = TVectorSingle.AndNot(Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask), temp);
1147Unsafe.BitCast<TVectorUInt32, TVectorSingle>(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x * 8388608.0f) - TVectorUInt32.Create(23u << 23)),
1151specialMask = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(temp);
1154TVectorUInt32 vx = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_OFF);
1155TVectorSingle n = ConvertToSingle<TVectorInt32, TVectorSingle>(Unsafe.BitCast<TVectorUInt32, TVectorInt32>(vx) >> 23);
1159TVectorSingle r = Unsafe.BitCast<TVectorUInt32, TVectorSingle>(vx) - TVectorSingle.Create(1.0f);
1186Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask),
1253TVectorUInt64 specialMask = TVectorUInt64.GreaterThanOrEqual(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_MIN), TVectorUInt64.Create(V_MAX - V_MIN));
1282TVectorDouble subnormalMask = TVectorDouble.AndNot(Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask), temp);
1287Unsafe.BitCast<TVectorUInt64, TVectorDouble>(Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x * 4503599627370496.0) - TVectorUInt64.Create(52ul << 52)),
1291specialMask = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(temp);
1295TVectorUInt64 vx = Unsafe.BitCast<TVectorDouble, TVectorUInt64>(x) - TVectorUInt64.Create(V_OFF);
1296TVectorDouble n = ConvertToDouble<TVectorInt64, TVectorDouble>(Unsafe.BitCast<TVectorUInt64, TVectorInt64>(vx) >> 52);
1300TVectorDouble r = Unsafe.BitCast<TVectorUInt64, TVectorDouble>(vx) - TVectorDouble.One;
1347Unsafe.BitCast<TVectorUInt64, TVectorDouble>(specialMask),
1430TVectorUInt32 specialMask = TVectorUInt32.GreaterThanOrEqual(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_MIN), TVectorUInt32.Create(V_MAX - V_MIN));
1459TVectorSingle subnormalMask = TVectorSingle.AndNot(Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask), temp);
1464Unsafe.BitCast<TVectorUInt32, TVectorSingle>(Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x * 8388608.0f) - TVectorUInt32.Create(23u << 23)),
1468specialMask = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(temp);
1472TVectorUInt32 vx = Unsafe.BitCast<TVectorSingle, TVectorUInt32>(x) - TVectorUInt32.Create(V_OFF);
1473TVectorSingle n = ConvertToSingle<TVectorInt32, TVectorSingle>(Unsafe.BitCast<TVectorUInt32, TVectorInt32>(vx) >> 23);
1477TVectorSingle r = Unsafe.BitCast<TVectorUInt32, TVectorSingle>(vx) - TVectorSingle.One;
1504Unsafe.BitCast<TVectorUInt32, TVectorSingle>(specialMask),
1803TVectorInt64 ux = Unsafe.BitCast<TVectorDouble, TVectorInt64>(ax);
1842Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
1848Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
1853TVectorInt64 sign = Unsafe.BitCast<TVectorDouble, TVectorInt64>(x) >>> 63;
1856Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(((sign & (region >>> 1)) | (~sign & ~(region >>> 1))) & TVectorInt64.One, TVectorInt64.Zero)),
1862Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals((region + TVectorInt64.One) & TVectorInt64.Create(2), TVectorInt64.Zero)),
1873Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.GreaterThan(ux, TVectorInt64.Create(ARG_SMALLER - 1))),
1879Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.GreaterThan(ux, TVectorInt64.Create(ARG_SMALLER - 1))),
1922TVectorInt32 ux = Unsafe.BitCast<TVectorSingle, TVectorInt32>(ax);
1997Unsafe.BitCast<TVectorInt32, TVectorSingle>(TVectorInt32.GreaterThan(ux, TVectorInt32.Create(ARG_SMALLER - 1))),
2003Unsafe.BitCast<TVectorInt32, TVectorSingle>(TVectorInt32.GreaterThan(ux, TVectorInt32.Create(ARG_SMALLER - 1))),
2019Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
2025Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
2030TVectorInt64 sign = Unsafe.BitCast<TVectorDouble, TVectorInt64>(x) >>> 63;
2033Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(((sign & (region >>> 1)) | (~sign & ~(region >>> 1))) & TVectorInt64.One, TVectorInt64.Zero)),
2039Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals((region + TVectorInt64.One) & TVectorInt64.Create(2), TVectorInt64.Zero)),
2123TVectorInt64 ux = Unsafe.BitCast<TVectorDouble, TVectorInt64>(ax);
2153Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
2158TVectorInt64 sign = Unsafe.BitCast<TVectorDouble, TVectorInt64>(x) >>> 63;
2161Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(((sign & (region >>> 1)) | (~sign & ~(region >>> 1))) & TVectorInt64.One, TVectorInt64.Zero)),
2172Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.GreaterThan(ux, TVectorInt64.Create(ARG_SMALLER - 1))),
2253TVectorInt32 ux = Unsafe.BitCast<TVectorSingle, TVectorInt32>(ax);
2310Unsafe.BitCast<TVectorInt32, TVectorSingle>(TVectorInt32.GreaterThan(ux, TVectorInt32.Create(ARG_SMALLER - 1))),
2325Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(region & TVectorInt64.One, TVectorInt64.Zero)),
2330TVectorInt64 sign = Unsafe.BitCast<TVectorDouble, TVectorInt64>(x) >>> 63;
2333Unsafe.BitCast<TVectorInt64, TVectorDouble>(TVectorInt64.Equals(((sign & (region >>> 1)) | (~sign & ~(region >>> 1))) & TVectorInt64.One, TVectorInt64.Zero)),
2358Unsafe.SkipInit(out TVectorDouble result);
2393Unsafe.SkipInit(out TVectorSingle result);
2517Unsafe.SkipInit(out TVector result);
2551Unsafe.SkipInit(out TVector result);
2586Unsafe.SkipInit(out TVectorSingle result);
2643Unsafe.SkipInit(out TVectorSingle result);
2682Unsafe.SkipInit(out TVectorUInt32 result);
2731Unsafe.SkipInit(out TVectorUInt64 result);
2880TVectorInt64 region = Unsafe.BitCast<TVectorDouble, TVectorInt64>(npi2);
2899Unsafe.SkipInit(out TVectorDouble result);
2968Unsafe.SkipInit(out TVectorDouble result);
3008Unsafe.SkipInit(out TVectorDouble result);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
40SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
44SpanHelpers.LastIndexOfValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any4SearchValues.cs (4)
39SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
43SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
47SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
51SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any5SearchValues.cs (4)
40SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
44SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
48SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
52SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiCharSearchValues.cs (6)
49ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
57ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
65ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
73ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
81ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
89ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\IndexOfAnyAsciiSearcher.cs (102)
193TryIndexOfAny<DontNegate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index);
197TryIndexOfAny<Negate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index);
201TryLastIndexOfAny<DontNegate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index);
205TryLastIndexOfAny<Negate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index);
295ref short searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
297while (!Unsafe.AreSame(ref currentSearchSpace, ref searchSpaceEnd))
305currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 1);
325ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - (2 * Vector256<short>.Count));
338currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count);
340while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
347ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector256<short>.Count);
349ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
378ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - (2 * Vector128<short>.Count));
391currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count);
393while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
400ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<short>.Count);
402ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
431char c = (char)Unsafe.Add(ref searchSpace, i);
441ref short currentSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
457ref short twoVectorsAfterStart = ref Unsafe.Add(ref searchSpace, 2 * Vector256<short>.Count);
461currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, 2 * Vector256<short>.Count);
472while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref twoVectorsAfterStart));
479ref short oneVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector256<short>.Count);
481ref short secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAfterStart)
482? ref Unsafe.Subtract(ref currentSearchSpace, Vector256<short>.Count)
508ref short twoVectorsAfterStart = ref Unsafe.Add(ref searchSpace, 2 * Vector128<short>.Count);
512currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, 2 * Vector128<short>.Count);
523while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref twoVectorsAfterStart));
530ref short oneVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<short>.Count);
532ref short secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAfterStart)
533? ref Unsafe.Subtract(ref currentSearchSpace, Vector128<short>.Count)
580ref byte searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
582while (!Unsafe.AreSame(ref currentSearchSpace, ref searchSpaceEnd))
590currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 1);
608ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector256<byte>.Count);
620currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<byte>.Count);
622while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd));
629ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count);
631ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd)
657ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count);
669currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<byte>.Count);
671while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd));
678ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - sizeof(ulong));
680ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd)
684ulong source0 = Unsafe.ReadUnaligned<ulong>(ref firstVector);
685ulong source1 = Unsafe.ReadUnaligned<ulong>(ref halfVectorAwayFromEnd);
709byte b = Unsafe.Add(ref searchSpace, i);
719ref byte currentSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
733ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector256<byte>.Count);
737currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector256<byte>.Count);
747while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart));
754ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count);
756ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart)
757? ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count)
782ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count);
786currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count);
796while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart));
803ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, sizeof(ulong));
805ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart)
806? ref Unsafe.Subtract(ref currentSearchSpace, sizeof(ulong))
809ulong source0 = Unsafe.ReadUnaligned<ulong>(ref searchSpace);
810ulong source1 = Unsafe.ReadUnaligned<ulong>(ref secondVector);
851ref byte searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
853while (!Unsafe.AreSame(ref currentSearchSpace, ref searchSpaceEnd))
861currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 1);
880ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector256<byte>.Count);
892currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector256<byte>.Count);
894while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd));
901ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count);
903ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd)
932ref byte vectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - Vector128<byte>.Count);
944currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, Vector128<byte>.Count);
946while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref vectorAwayFromEnd));
953ref byte halfVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength - sizeof(ulong));
955ref byte firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAwayFromEnd)
959ulong source0 = Unsafe.ReadUnaligned<ulong>(ref firstVector);
960ulong source1 = Unsafe.ReadUnaligned<ulong>(ref halfVectorAwayFromEnd);
983byte b = Unsafe.Add(ref searchSpace, i);
993ref byte currentSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
1008ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector256<byte>.Count);
1012currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector256<byte>.Count);
1022while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart));
1029ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count);
1031ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart)
1032? ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count)
1060ref byte vectorAfterStart = ref Unsafe.Add(ref searchSpace, Vector128<byte>.Count);
1064currentSearchSpace = ref Unsafe.Subtract(ref currentSearchSpace, Vector128<byte>.Count);
1074while (Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref vectorAfterStart));
1081ref byte halfVectorAfterStart = ref Unsafe.Add(ref searchSpace, sizeof(ulong));
1083ref byte secondVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref halfVectorAfterStart)
1084? ref Unsafe.Subtract(ref currentSearchSpace, sizeof(ulong))
1087ulong source0 = Unsafe.ReadUnaligned<ulong>(ref searchSpace);
1088ulong source1 = Unsafe.ReadUnaligned<ulong>(ref secondVector);
1257return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T));
1272return offsetInVector - Vector128<short>.Count + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref secondVector) / (nuint)sizeof(T));
1288return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T));
1310return offsetInVector - Vector256<short>.Count + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref secondVector) / (nuint)sizeof(T));
1464return (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T));
1472return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T));
1487return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / (nuint)sizeof(T));
1501return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / (nuint)sizeof(T));
1522return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / (nuint)sizeof(T));
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (69)
85Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) |= (byte)(1u << (value >> VectorizedIndexShift));
89Unsafe.Add(ref charMap, value & PortableIndexMask) |= 1u << (value >> PortableIndexShift);
96? (Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) & (1u << (value >> VectorizedIndexShift))) != 0
97: (Unsafe.Add(ref charMap, value & PortableIndexMask) & (1u << (value >> PortableIndexShift))) != 0;
108ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(values)),
426ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
428Vector256<byte> charMap256 = Vector256.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map));
437ref char lastStartVector = ref Unsafe.Subtract(ref searchSpaceEnd, 64);
441Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref cur, ref Unsafe.Add(ref cur, Vector512<ushort>.Count));
451cur = ref Unsafe.Add(ref cur, 64);
453if (Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector))
455if (Unsafe.AreSame(ref cur, ref searchSpaceEnd))
471Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref searchSpace, ref Unsafe.Subtract(ref searchSpaceEnd, Vector512<ushort>.Count));
488Vector256<byte> result = ContainsMask32CharsAvx512(charMap256, ref searchSpace, ref Unsafe.Subtract(ref searchSpaceEnd, Vector256<ushort>.Count));
510ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
513Vector128<byte> charMapLower = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map));
514Vector128<byte> charMapUpper = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map), (nuint)Vector128<byte>.Count);
523ref char lastStartVectorAvx2 = ref Unsafe.Subtract(ref searchSpaceEnd, 32);
537cur = ref Unsafe.Add(ref cur, 32);
539if (Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVectorAvx2))
541if (Unsafe.AreSame(ref cur, ref searchSpaceEnd))
546if (Unsafe.ByteOffset(ref cur, ref searchSpaceEnd) > 16 * sizeof(char))
556cur = ref Unsafe.Subtract(ref searchSpaceEnd, 16);
563ref char lastStartVector = ref Unsafe.Subtract(ref searchSpaceEnd, 16);
577cur = ref Unsafe.Add(ref cur, 16);
579if (Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector))
581if (Unsafe.AreSame(ref cur, ref searchSpaceEnd))
601ref char cur = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
603Vector256<byte> charMap256 = Vector256.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map));
611ref char lastStartVector = ref Unsafe.Add(ref searchSpace, 64);
615Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 64 * sizeof(char));
617cur = ref Unsafe.Subtract(ref cur, 64);
619Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref cur, ref Unsafe.Add(ref cur, Vector512<ushort>.Count));
629if (!Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector))
631if (Unsafe.AreSame(ref cur, ref searchSpace))
644Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 32 * sizeof(char));
648Vector512<byte> result = ContainsMask64CharsAvx512(charMap512, ref searchSpace, ref Unsafe.Subtract(ref cur, Vector512<ushort>.Count));
662Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 16 * sizeof(char));
666Vector256<byte> result = ContainsMask32CharsAvx512(charMap256, ref searchSpace, ref Unsafe.Subtract(ref cur, Vector256<ushort>.Count));
688ref char cur = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
690Vector128<byte> charMapLower = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map));
691Vector128<byte> charMapUpper = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map), (nuint)Vector128<byte>.Count);
700ref char lastStartVectorAvx2 = ref Unsafe.Add(ref searchSpace, 32);
704Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 32 * sizeof(char));
706cur = ref Unsafe.Subtract(ref cur, 32);
718if (!Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVectorAvx2))
720if (Unsafe.AreSame(ref cur, ref searchSpace))
725if (Unsafe.ByteOffset(ref searchSpace, ref cur) > 16 * sizeof(char))
735cur = ref Unsafe.Add(ref searchSpace, 16);
742ref char lastStartVector = ref Unsafe.Add(ref searchSpace, 16);
746Debug.Assert(Unsafe.ByteOffset(ref searchSpace, ref cur) >= 16 * sizeof(char));
748cur = ref Unsafe.Subtract(ref cur, 16);
760if (!Unsafe.IsAddressGreaterThan(ref cur, ref lastStartVector))
762if (Unsafe.AreSame(ref cur, ref searchSpace))
777(int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref cur) / sizeof(char));
787if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
815if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
836if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
864if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
885if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
917if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
936if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
968if (state.ConfirmProbabilisticMatch<TUseFastContains>(Unsafe.Add(ref cur, index)))
983ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
986while (!Unsafe.AreSame(ref cur, ref searchSpaceEnd))
994cur = ref Unsafe.Add(ref cur, 1);
1006char c = Unsafe.Add(ref searchSpace, i);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (11)
88return Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(hashEntries), (nuint)offset) == value;
98ref Unsafe.As<ProbabilisticMap, uint>(ref Map),
234ref char searchSpaceEnd = ref Unsafe.Add(ref searchSpace, searchSpaceLength);
244while (!Unsafe.AreSame(ref cur, ref searchSpaceEnd))
249return (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref cur) / sizeof(char));
252cur = ref Unsafe.Add(ref cur, 1);
257while (!Unsafe.AreSame(ref cur, ref searchSpaceEnd))
262return (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref cur) / sizeof(char));
265cur = ref Unsafe.Add(ref cur, 1);
286char c = Unsafe.Add(ref searchSpace, searchSpaceLength);
297char 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\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\StringSearchValuesHelper.cs (35)
30nint currentByteOffset = Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref searchSpace);
75ref Unsafe.As<char, byte>(ref matchStart),
150Vector128.LoadUnsafe(ref Unsafe.AddByteOffset(ref value.GetRawStringDataAsUInt16(), SecondReadByteOffset)));
156Unsafe.ReadUnaligned<ulong>(ref value.GetRawStringDataAsUInt8()),
157Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref value.GetRawStringDataAsUInt8(), SecondReadByteOffset))
166Unsafe.ReadUnaligned<uint>(ref value.GetRawStringDataAsUInt8()),
167Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref value.GetRawStringDataAsUInt8(), SecondReadByteOffset))
192Vector128.LoadUnsafe(ref Unsafe.AddByteOffset(ref matchStart, SecondReadByteOffset)));
199different |= Vector128.LoadUnsafe(ref Unsafe.AddByteOffset(ref matchStart, SecondReadByteOffset)) ^ Value256.GetUpper();
214Vector128.LoadUnsafe(ref Unsafe.AddByteOffset(ref matchStart, SecondReadByteOffset)));
221different |= (Vector128.LoadUnsafe(ref Unsafe.AddByteOffset(ref matchStart, SecondReadByteOffset)) & ToUpperMask256.GetUpper()) ^ Value256.GetUpper();
265ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart);
266ulong differentBits = Unsafe.ReadUnaligned<ulong>(ref matchByteStart) - state.Value64_0;
267differentBits |= Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) - state.Value64_1;
277ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart);
278return Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) == state.Value32_1;
314ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart);
315ulong differentBits = (Unsafe.ReadUnaligned<ulong>(ref matchByteStart) & CaseMask) - state.Value64_0;
316differentBits |= (Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) & CaseMask) - state.Value64_1;
327ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart);
328return (Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) & CaseMask) == state.Value32_1;
387ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart);
388ulong differentBits = (Unsafe.ReadUnaligned<ulong>(ref matchByteStart) & state.ToUpperMask64_0) - state.Value64_0;
389differentBits |= (Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) & state.ToUpperMask64_1) - state.Value64_1;
397ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart);
398uint differentBits = (Unsafe.ReadUnaligned<uint>(ref matchByteStart) & state.ToUpperMask32_0) - state.Value32_0;
399differentBits |= (Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref matchByteStart, state.SecondReadByteOffset)) & state.ToUpperMask32_1) - state.Value32_1;
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (32)
97ref char lastSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceMinusValueTailLength - Vector512<ushort>.Count);
115searchSpace = ref Unsafe.Add(ref searchSpace, Vector512<ushort>.Count);
117if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpace))
119if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpace, Vector512<ushort>.Count)))
145ref char lastSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceMinusValueTailLength - Vector256<ushort>.Count);
162searchSpace = ref Unsafe.Add(ref searchSpace, Vector256<ushort>.Count);
164if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpace))
166if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpace, Vector256<ushort>.Count)))
192ref char lastSearchSpace = ref Unsafe.Add(ref searchSpace, searchSpaceMinusValueTailLength - Vector128<ushort>.Count);
209searchSpace = ref Unsafe.Add(ref searchSpace, Vector128<ushort>.Count);
211if (Unsafe.IsAddressGreaterThan(ref searchSpace, ref lastSearchSpace))
213if (Unsafe.AreSame(ref searchSpace, ref Unsafe.Add(ref lastSearchSpace, Vector128<ushort>.Count)))
239ref char cur = ref Unsafe.Add(ref searchSpace, i);
260Vector128<ushort> cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16());
261Vector128<ushort> cmpCh3 = Vector128.Equals(ch3, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16());
273Vector128<ushort> cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion);
274Vector128<ushort> cmpCh3 = Vector128.Equals(ch3, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion);
288Vector256<ushort> cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16());
289Vector256<ushort> cmpCh3 = Vector256.Equals(ch3, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16());
297Vector256<ushort> cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion);
298Vector256<ushort> cmpCh3 = Vector256.Equals(ch3, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion);
311Vector512<ushort> cmpCh2 = Vector512.Equals(ch2, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16());
312Vector512<ushort> cmpCh3 = Vector512.Equals(ch3, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16());
320Vector512<ushort> cmpCh2 = Vector512.Equals(ch2, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion);
321Vector512<ushort> cmpCh3 = Vector512.Equals(ch3, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion);
336ref char matchRef = ref Unsafe.AddByteOffset(ref searchSpace, bitPos);
342offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref searchSpaceStart, ref matchRef) / 2);
364ref char matchRef = ref Unsafe.AddByteOffset(ref searchSpace, bitPos);
370offsetFromStart = (int)((nuint)Unsafe.ByteOffset(ref searchSpaceStart, ref matchRef) / 2);
src\libraries\System.Private.CoreLib\src\System\Span.cs (9)
88_reference = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */);
155return ref Unsafe.Add(ref _reference, (nint)(uint)index /* force zero-extension */);
285ref T ret = ref Unsafe.NullRef<T>();
298SpanHelpers.ClearWithReferences(ref Unsafe.As<T, IntPtr>(ref _reference), (uint)_length * (nuint)(sizeof(T) / sizeof(nuint)));
302SpanHelpers.ClearWithoutReferences(ref Unsafe.As<T, byte>(ref _reference), (uint)_length * (nuint)sizeof(T));
366Unsafe.AreSame(ref left._reference, ref right._reference);
382return new string(new ReadOnlySpan<char>(ref Unsafe.As<T, char>(ref _reference), _length));
400return new Span<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), _length - start);
428return new Span<T>(ref Unsafe.Add(ref _reference, (nint)(uint)start /* force zero-extension */), length);
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)
40if ((nuint)Unsafe.ByteOffset(ref src, ref dest) < len ||
41(nuint)Unsafe.ByteOffset(ref dest, ref src) < len)
46ref byte srcEnd = ref Unsafe.Add(ref src, len);
47ref byte destEnd = ref Unsafe.Add(ref dest, len);
58Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<Block16>(ref src));
71Unsafe.WriteUnaligned(ref Unsafe.Add(ref dest, 16), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref src, 16)));
84Unsafe.WriteUnaligned(ref Unsafe.Add(ref dest, 32), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref src, 32)));
99Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -16), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref srcEnd, -16)));
117Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<long>(ref src));
118Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -8), Unsafe.ReadUnaligned<long>(ref Unsafe.Add(ref srcEnd, -8)));
132Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<int>(ref src));
133Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -4), Unsafe.ReadUnaligned<int>(ref Unsafe.Add(ref srcEnd, -4)));
144Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -2), Unsafe.ReadUnaligned<short>(ref Unsafe.Add(ref srcEnd, -2)));
162nuint misalignedElements = 64 - Unsafe.OpportunisticMisalignment(ref dest, 64);
163Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<Block64>(ref src));
164src = ref Unsafe.Add(ref src, misalignedElements);
165dest = ref Unsafe.Add(ref dest, misalignedElements);
177Unsafe.WriteUnaligned(ref dest, Unsafe.ReadUnaligned<Block64>(ref src));
205dest = ref Unsafe.Add(ref dest, 64);
206src = ref Unsafe.Add(ref src, 64);
215Unsafe.WriteUnaligned(ref Unsafe.Add(ref destEnd, -16), Unsafe.ReadUnaligned<Block16>(ref Unsafe.Add(ref srcEnd, -16)));
230if (Unsafe.AreSame(ref dest, ref src))
233_ = Unsafe.ReadUnaligned<byte>(ref dest);
240_ = Unsafe.ReadUnaligned<byte>(ref dest);
241_ = Unsafe.ReadUnaligned<byte>(ref src);
251ref byte destEnd = ref Unsafe.Add(ref dest, len);
262Unsafe.WriteUnaligned<Block16>(ref dest, default);
275Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref dest, 16), default);
288Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref dest, 32), default);
303Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref destEnd, -16), default);
321Unsafe.WriteUnaligned<long>(ref dest, 0);
322Unsafe.WriteUnaligned<long>(ref Unsafe.Add(ref destEnd, -8), 0);
336Unsafe.WriteUnaligned<int>(ref dest, 0);
337Unsafe.WriteUnaligned<int>(ref Unsafe.Add(ref destEnd, -4), 0);
348Unsafe.WriteUnaligned<short>(ref Unsafe.Add(ref destEnd, -2), 0);
363nuint misalignedElements = 64 - Unsafe.OpportunisticMisalignment(ref dest, 64);
364Unsafe.WriteUnaligned<Block64>(ref dest, default);
365dest = ref Unsafe.Add(ref dest, misalignedElements);
376Unsafe.WriteUnaligned<Block64>(ref dest, default);
404dest = ref Unsafe.Add(ref dest, 64);
413Unsafe.WriteUnaligned<Block16>(ref Unsafe.Add(ref destEnd, -16), default);
427_ = Unsafe.ReadUnaligned<byte>(ref dest);
452Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, offset), vector);
453Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, offset + (nuint)Vector<byte>.Count), vector);
465Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, offset), vector);
474Unsafe.WriteUnaligned(ref Unsafe.AddByteOffset(ref dest, len - (nuint)Vector<byte>.Count), vector);
492Unsafe.Add(ref dest, (nint)i + 0) = value;
493Unsafe.Add(ref dest, (nint)i + 1) = value;
494Unsafe.Add(ref dest, (nint)i + 2) = value;
495Unsafe.Add(ref dest, (nint)i + 3) = value;
496Unsafe.Add(ref dest, (nint)i + 4) = value;
497Unsafe.Add(ref dest, (nint)i + 5) = value;
498Unsafe.Add(ref dest, (nint)i + 6) = value;
499Unsafe.Add(ref dest, (nint)i + 7) = value;
506Unsafe.Add(ref dest, (nint)i + 0) = value;
507Unsafe.Add(ref dest, (nint)i + 1) = value;
508Unsafe.Add(ref dest, (nint)i + 2) = value;
509Unsafe.Add(ref dest, (nint)i + 3) = value;
516Unsafe.Add(ref dest, (nint)i + 0) = value;
517Unsafe.Add(ref dest, (nint)i + 1) = value;
524Unsafe.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)
15Debug.Assert(Unsafe.IsOpportunisticallyAligned(ref ip, (uint)sizeof(IntPtr)), "Should've been aligned on natural word boundary.");
23Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -1) = default;
24Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -2) = default;
25Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -3) = default;
26Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -4) = default;
27Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -5) = default;
28Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -6) = default;
29Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -7) = default;
30Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -8) = default;
69Unsafe.Add(ref ip, 2) = default;
70Unsafe.Add(ref ip, 3) = default;
71Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -3) = default;
72Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -2) = default;
78Unsafe.Add(ref ip, 1) = default;
79Unsafe.Add(ref Unsafe.Add(ref ip, (nint)pointerSizeLength), -1) = default;
189ReverseInner(ref Unsafe.Add(ref buf, offset), (nuint)remainder);
294ReverseInner(ref Unsafe.Add(ref buf, offset), (nuint)remainder);
307Reverse(ref Unsafe.As<T, byte>(ref elements), length);
312Reverse(ref Unsafe.As<T, char>(ref elements), length);
317Reverse(ref Unsafe.As<T, int>(ref elements), length);
322Reverse(ref Unsafe.As<T, long>(ref elements), length);
336ref T last = ref Unsafe.Subtract(ref Unsafe.Add(ref first, length), 1);
342first = ref Unsafe.Add(ref first, 1);
343last = ref Unsafe.Subtract(ref last, 1);
344} while (Unsafe.IsAddressLessThan(ref first, ref last));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Packed.cs (111)
28return Unsafe.BitCast<T, ushort>(value) - 1u < 254u;
34IndexOf<SpanHelpers.DontNegate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length);
39IndexOf<SpanHelpers.Negate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length);
44IndexOfAny<SpanHelpers.DontNegate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length);
49IndexOfAny<SpanHelpers.Negate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length);
54IndexOfAny<SpanHelpers.DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, (short)value2, length);
59IndexOfAny<SpanHelpers.Negate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, (short)value2, length);
67return IndexOf<SpanHelpers.DontNegate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length);
76return IndexOf<SpanHelpers.Negate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length);
86return IndexOfAny<SpanHelpers.DontNegate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length);
96return IndexOfAny<SpanHelpers.Negate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length);
102IndexOfAnyInRange<SpanHelpers.DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)lowInclusive, (short)rangeInclusive, length);
107IndexOfAnyInRange<SpanHelpers.Negate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)lowInclusive, (short)rangeInclusive, length);
123Unsafe.Add(ref searchSpace, 1) == value ||
124Unsafe.Add(ref searchSpace, 2) == value ||
125Unsafe.Add(ref searchSpace, 3) == value)
137if (Unsafe.Add(ref searchSpace, offset) == value)
160ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count));
173currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count);
175while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
181ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count);
183ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
209ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count));
223currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count);
225while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
231ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count);
233ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
267ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count));
281currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count);
283while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
289ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count);
291ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
327if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, 1)) == value)) return 1;
328if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, 2)) == value)) return 2;
329if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, 3)) == value)) return 3;
338if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset)) == value)) return (int)offset;
359ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count));
372currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count);
374while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
380ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count);
382ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
408ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count));
423currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count);
425while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
431ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count);
433ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
468ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count));
483currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count);
485while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
491ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count);
493ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
533lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, 1));
535lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, 2));
537lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, 3));
547lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset));
569ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count));
583currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count);
585while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
591ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count);
593ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
621ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count));
636currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count);
638while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
644ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count);
646ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
682ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count));
697currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count);
699while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
705ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count);
707ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
747lookUp = Unsafe.Add(ref searchSpace, 1);
749lookUp = Unsafe.Add(ref searchSpace, 2);
751lookUp = Unsafe.Add(ref searchSpace, 3);
761lookUp = Unsafe.Add(ref searchSpace, offset);
785ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count));
799currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count);
801while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
807ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count);
809ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
838ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count));
853currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count);
855while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
861ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count);
863ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
900ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count));
915currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count);
917while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
923ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count);
925ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
960uint current = (uint)Unsafe.Add(ref searchSpace, i);
984ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector512<short>.Count));
997currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector512<short>.Count);
999while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
1005ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector512<short>.Count);
1007ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
1034ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector256<short>.Count));
1049currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector256<short>.Count);
1051while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
1057ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector256<short>.Count);
1059ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
1095ref short twoVectorsAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - (2 * Vector128<short>.Count));
1110currentSearchSpace = ref Unsafe.Add(ref currentSearchSpace, 2 * Vector128<short>.Count);
1112while (Unsafe.IsAddressLessThan(ref currentSearchSpace, ref twoVectorsAwayFromEnd));
1118ref short oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, length - Vector128<short>.Count);
1120ref short firstVector = ref Unsafe.IsAddressGreaterThan(ref currentSearchSpace, ref oneVectorAwayFromEnd)
1234return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / sizeof(short));
1243return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / sizeof(short));
1252return index + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current) / sizeof(short));
1266return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / sizeof(short));
1281return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / sizeof(short));
1296return offsetInVector + (int)((nuint)Unsafe.ByteOffset(ref searchSpace, ref current0) / sizeof(short));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (419)
36vector = new Vector<byte>(Unsafe.BitCast<T, byte>(value));
40vector = (Vector<byte>)new Vector<ushort>(Unsafe.BitCast<T, ushort>(value));
46? (Vector<byte>)new Vector<float>(Unsafe.BitCast<T, float>(value))
47: (Vector<byte>)new Vector<uint>(Unsafe.BitCast<T, uint>(value));
53? (Vector<byte>)new Vector<double>(Unsafe.BitCast<T, double>(value))
54: (Vector<byte>)new Vector<ulong>(Unsafe.BitCast<T, ulong>(value));
58vector = Unsafe.BitCast<T, Vector<byte>>(value);
64vector = Vector256.Create(Unsafe.BitCast<T, Vector128<byte>>(value)).AsVector();
68vector = Vector512.Create(Unsafe.BitCast<T, Vector128<byte>>(value)).AsVector();
80vector = Vector512.Create(Unsafe.BitCast<T, Vector256<byte>>(value)).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);
3789while (Unsafe.IsAddressLessThan(ref current, ref oneVectorAwayFromEnd))
3792current = ref Unsafe.Add(ref current, Vector512<T>.Count);
3797mask >>= (int)((nuint)Unsafe.ByteOffset(ref oneVectorAwayFromEnd, ref current) / (uint)sizeof(T));
3803ref T oneVectorAwayFromEnd = ref Unsafe.Subtract(ref end, Vector256<T>.Count);
3804while (Unsafe.IsAddressLessThan(ref current, ref oneVectorAwayFromEnd))
3807current = ref Unsafe.Add(ref current, Vector256<T>.Count);
3812mask >>= (int)((nuint)Unsafe.ByteOffset(ref oneVectorAwayFromEnd, ref current) / (uint)sizeof(T));
3818ref T oneVectorAwayFromEnd = ref Unsafe.Subtract(ref end, Vector128<T>.Count);
3819while (Unsafe.IsAddressLessThan(ref current, ref oneVectorAwayFromEnd))
3822current = ref Unsafe.Add(ref current, Vector128<T>.Count);
3827mask >>= (int)((nuint)Unsafe.ByteOffset(ref oneVectorAwayFromEnd, ref current) / (uint)sizeof(T));
3833while (Unsafe.IsAddressLessThan(ref current, ref end))
3840current = ref Unsafe.Add(ref current, 1);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (16)
45ref Unsafe.Add(ref strA.GetRawStringData(), (nint)(uint)indexA /* force zero-extension */), countA,
46ref Unsafe.Add(ref strB.GetRawStringData(), (nint)(uint)indexB /* force zero-extension */), countB);
421return Ordinal.CompareStringIgnoreCase(ref Unsafe.Add(ref strA.GetRawStringData(), indexA), lengthA, ref Unsafe.Add(ref strB.GetRawStringData(), indexB), lengthB);
570Ordinal.EqualsIgnoreCase(ref Unsafe.Add(ref GetRawStringData(), Length - value.Length),
605return Unsafe.Add(ref _firstChar, (nint)localLength - 1) == value;
758return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref _firstChar), (uint)_stringLength * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32));
779return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32));
877hash1 = BitOperations.RotateLeft(hash1, 5) + hash1 ^ Unsafe.ReadUnaligned<uint>(ptr);
878hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ Unsafe.ReadUnaligned<uint>(ptr + 1);
885hash1 = BitOperations.RotateLeft(hash1, 5) + hash1 ^ Unsafe.ReadUnaligned<uint>(ptr);
896hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ Unsafe.ReadUnaligned<uint>(ptr);
987p0 = Unsafe.ReadUnaligned<uint>(ptr);
988p1 = Unsafe.ReadUnaligned<uint>(ptr + 1);
1003p0 = Unsafe.ReadUnaligned<uint>(ptr);
1020p0 = Unsafe.ReadUnaligned<uint>(ptr);
src\libraries\System.Private.CoreLib\src\System\String.cs (9)
112source: ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(value), startIndex));
386slice = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, (nint)(uint)startIndex /* force zero-extension */), count);
427destination: ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(destination), destinationIndex),
428source: ref Unsafe.Add(ref _firstChar, sourceIndex),
497source: ref Unsafe.Add(ref _firstChar, startIndex),
528internal ref byte GetRawStringDataAsUInt8() => ref Unsafe.As<char, byte>(ref _firstChar);
529internal ref ushort GetRawStringDataAsUInt16() => ref Unsafe.As<char, ushort>(ref _firstChar);
573Unsafe.Add(ref result._firstChar, 1) = c2;
735return Unsafe.Add(ref _firstChar, (nint)(uint)index /* force zero-extension */);
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (25)
63destination: ref Unsafe.Add(ref dest._firstChar, destPos),
713Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref value._firstChar, (nuint)insertLength);
714Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex + insertLength), ref Unsafe.Add(ref _firstChar, startIndex), (nuint)(oldLength - startIndex));
927return JoinCore(separator, CollectionsMarshal.AsSpan(Unsafe.As<List<string?>>(values)));
950IEnumerator<char> en = Unsafe.As<IEnumerator<char>>(e);
1101ref char dest = ref Unsafe.Add(ref result._firstChar, copiedLength);
1138Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, count), ref _firstChar, (nuint)oldLength);
1156new Span<char>(ref Unsafe.Add(ref result._firstChar, oldLength), count).Fill(paddingChar);
1177Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref Unsafe.Add(ref _firstChar, startIndex + count), (nuint)(newLength - startIndex));
1293ref ushort pSrc = ref Unsafe.Add(ref GetRawStringDataAsUInt16(), (uint)copyLength);
1294ref ushort pDst = ref Unsafe.Add(ref result.GetRawStringDataAsUInt16(), (uint)copyLength);
1303pSrc = ref Unsafe.Subtract(ref pSrc, adjust);
1304pDst = ref Unsafe.Subtract(ref pDst, adjust);
1310pSrc = ref Unsafe.Subtract(ref pSrc, adjust);
1311pDst = ref Unsafe.Subtract(ref pDst, adjust);
1317pSrc = ref Unsafe.Subtract(ref pSrc, adjust);
1318pDst = ref Unsafe.Subtract(ref pDst, adjust);
1357int pos = PackedSpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), c, Length - i);
1370int pos = SpanHelpers.NonPackedIndexOfChar(ref Unsafe.Add(ref _firstChar, i), c, Length - i);
1386int 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);
2133char curr = Unsafe.Add(ref source, offset);
2289source: 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);
98int result = SpanHelpers.IndexOfChar(ref Unsafe.Add(ref _firstChar, startIndex), value, count);
138int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startIndex), count).IndexOfAny(anyOf);
270=> SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length);
295int result = SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref Unsafe.Add(ref _firstChar, startSearchAt)), (short)value, count);
343int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startSearchAt), count).LastIndexOfAny(anyOf);
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 (44)
31&& Equals<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
40&& 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);
56uint valueA = uint.CreateTruncating(Unsafe.Add(ref left, i));
57uint valueB = uint.CreateTruncating(Unsafe.Add(ref right, i));
73ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector512<TLeft>.Count);
83currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, Vector512<TLeft>.Count);
84currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, Vector512<TLeft>.Count);
86while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd));
91ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector512<TLeft>.Count);
103ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector256<TLeft>.Count);
113currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, Vector256<TLeft>.Count);
114currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, Vector256<TLeft>.Count);
116while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd));
121ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector256<TLeft>.Count);
128ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count128);
130ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector128<TRight>.Count);
147currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector128<TRight>.Count);
148currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count128);
150while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd));
182&& EqualsIgnoreCase<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
191&& 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);
194EqualsIgnoreCase<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref left), ref Unsafe.As<char, ushort>(ref right), length);
210uint valueA = uint.CreateTruncating(Unsafe.Add(ref left, i));
211uint valueB = uint.CreateTruncating(Unsafe.Add(ref right, i));
238ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count512);
240ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector512<TRight>.Count);
274currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector512<TRight>.Count);
275currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count512);
277while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd));
309ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count256);
311ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector256<TRight>.Count);
346currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector256<TRight>.Count);
347currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count256);
349while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd));
381ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count128);
383ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector128<TRight>.Count);
419currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector128<TRight>.Count);
420currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count128);
422while (!Unsafe.IsAddressGreaterThan(ref currentRightSearchSpace, ref oneVectorAwayFromRightEnd));
523Vector128<byte> vec = Vector128.CreateScalarUnsafe(Unsafe.ReadUnaligned<long>(ref ptr)).AsByte();
528Vector128<byte> vec = Vector128.CreateScalarUnsafe(Unsafe.ReadUnaligned<long>(ref ptr)).AsByte();
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.cs (45)
266currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer);
267uint nextUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer + 4);
291currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer);
304currentUInt32 = Unsafe.ReadUnaligned<ushort>(pBuffer);
636ulong candidateUInt64 = Unsafe.ReadUnaligned<ulong>(pBuffer);
651currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer);
652uint nextDWord = Unsafe.ReadUnaligned<uint>(pBuffer + 4);
676currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer);
691currentDWord = Unsafe.ReadUnaligned<ushort>(pBuffer);
885currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer);
886uint nextUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer + 4 / sizeof(char));
910currentUInt32 = Unsafe.ReadUnaligned<uint>(pBuffer);
1192ulong candidateUInt64 = Unsafe.ReadUnaligned<ulong>(pBuffer);
1209currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer);
1210uint nextDWord = Unsafe.ReadUnaligned<uint>(pBuffer + 4 / sizeof(char));
1234currentDWord = Unsafe.ReadUnaligned<uint>(pBuffer);
1277Unsafe.WriteUnaligned(ref outputBuffer, Sse2.ConvertToUInt32(vecNarrow));
1286Unsafe.WriteUnaligned(ref outputBuffer, lower.AsUInt32().ToScalar());
1295Unsafe.Add(ref outputBuffer, 1) = (byte)value;
1297Unsafe.Add(ref outputBuffer, 2) = (byte)value;
1299Unsafe.Add(ref outputBuffer, 3) = (byte)value;
1303Unsafe.Add(ref outputBuffer, 3) = (byte)value;
1305Unsafe.Add(ref outputBuffer, 2) = (byte)value;
1307Unsafe.Add(ref outputBuffer, 1) = (byte)value;
1327Unsafe.Add(ref outputBuffer, 1) = (byte)(value >> 16);
1331Unsafe.Add(ref outputBuffer, 1) = (byte)value;
1358utf16Data64Bits = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer);
1366utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer);
1367utf16Data32BitsLow = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + 4 / sizeof(char));
1402utf16Data64Bits = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer + currentOffset);
1412utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset);
1413utf16Data32BitsLow = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset + 4 / sizeof(char));
1431utf16Data32BitsHigh = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + currentOffset);
2103asciiData = Unsafe.ReadUnaligned<uint>(pAsciiBuffer + currentOffset);
2118asciiData = Unsafe.ReadUnaligned<ushort>(pAsciiBuffer + currentOffset);
2282Unsafe.WriteUnaligned(ref Unsafe.As<char, byte>(ref outputBuffer), vecWide.ToScalar());
2288Unsafe.WriteUnaligned(ref Unsafe.As<char, byte>(ref outputBuffer), vecWide.ToScalar());
2297Unsafe.Add(ref outputBuffer, 1) = (char)(byte)value;
2299Unsafe.Add(ref outputBuffer, 2) = (char)(byte)value;
2301Unsafe.Add(ref outputBuffer, 3) = (char)value;
2305Unsafe.Add(ref outputBuffer, 3) = (char)(byte)value;
2307Unsafe.Add(ref outputBuffer, 2) = (char)(byte)value;
2309Unsafe.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\StringBuilder.cs (8)
340ref Unsafe.Add(ref result.GetRawStringData(), chunkOffset),
787Append(ref Unsafe.Add(ref value.GetRawStringData(), startIndex), count);
1238Debug.Assert(!Unsafe.IsNullRef(ref separator));
2277ref char destination = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(chunkChars), chunkLength);
2283Unsafe.Add(ref destination, 1) = Unsafe.Add(ref value, 1);
2324new ReadOnlySpan<char>(ref Unsafe.Add(ref value, firstLength), restLength).CopyTo(m_ChunkChars);
2491value = ref Unsafe.Add(ref value, lengthToCopy);
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)
69uint thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
96uint remainingInputBytes = (uint)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) + 4;
104thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
105secondDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer + sizeof(uint));
245thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
289Unsafe.WriteUnaligned(pOutputBuffer, ExtractTwoCharsPackedFromTwoAdjacentTwoByteSequences(thisDWord));
300thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
389thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
412thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
487if (outputCharsRemaining > 1 && (nint)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) >= 3)
496uint secondDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer + 3);
552thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
629Unsafe.WriteUnaligned(pOutputBuffer, ExtractCharsFromFourByteSequence(thisDWord));
640inputLength = (int)(void*)Unsafe.ByteOffset(ref *pInputBuffer, ref *pFinalPosWhereCanReadDWordFromInputBuffer) + 4;
905thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
933Unsafe.WriteUnaligned(pOutputBuffer, (ushort)valueToWrite);
957Unsafe.SkipInit(out nonAsciiUtf16DataMask);
959utf16Data = Unsafe.ReadUnaligned<Vector128<short>>(pInputBuffer);
1000possibleNonAsciiQWord = Unsafe.ReadUnaligned<ulong>(pInputBuffer);
1015Unsafe.WriteUnaligned(pOutputBuffer, Sse2.ConvertToUInt32(Sse2.PackUnsignedSaturate(utf16Data, utf16Data).AsUInt32()));
1058Unsafe.WriteUnaligned(pOutputBuffer, Sse2.ConvertToUInt32(Sse2.PackUnsignedSaturate(utf16Data, utf16Data).AsUInt32()));
1079Unsafe.WriteUnaligned(pOutputBuffer, (ushort)(thisDWord | (thisDWord >> 8)));
1097thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
1098secondDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer + 2);
1107Unsafe.WriteUnaligned(pOutputBuffer, (ushort)(thisDWord | (thisDWord >> 8)));
1108Unsafe.WriteUnaligned(pOutputBuffer + 2, (ushort)(secondDWord | (secondDWord >> 8)));
1128Unsafe.WriteUnaligned(pOutputBuffer, (ushort)(thisDWord | (thisDWord >> 8)));
1174thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
1196Unsafe.WriteUnaligned(pOutputBuffer, ExtractTwoUtf8TwoByteSequencesFromTwoPackedUtf16Chars(thisDWord));
1211thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
1230Unsafe.WriteUnaligned(pOutputBuffer, (ushort)ExtractUtf8TwoByteSequenceFromFirstUtf16Char(thisDWord));
1271thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
1310thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
1368thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
1388thisDWord = Unsafe.ReadUnaligned<uint>(pInputBuffer);
1402Unsafe.WriteUnaligned(pOutputBuffer, ExtractFourUtf8BytesFromSurrogatePair(thisDWord));
src\libraries\System.Private.CoreLib\src\System\Threading\Interlocked.cs (67)
44(uint)Add(ref Unsafe.As<uint, int>(ref location), -1);
53(ulong)Add(ref Unsafe.As<ulong, long>(ref location), -1);
66(sbyte)Exchange(ref Unsafe.As<sbyte, byte>(ref location1), (byte)value);
76(short)Exchange(ref Unsafe.As<short, ushort>(ref location1), (ushort)value);
164(uint)Exchange(ref Unsafe.As<uint, int>(ref location1), (int)value);
175(ulong)Exchange(ref Unsafe.As<ulong, long>(ref location1), (long)value);
184=> Unsafe.BitCast<int, float>(Exchange(ref Unsafe.As<float, int>(ref location1), Unsafe.BitCast<float, int>(value)));
193=> Unsafe.BitCast<long, double>(Exchange(ref Unsafe.As<double, long>(ref location1), Unsafe.BitCast<double, long>(value)));
206return (IntPtr)Interlocked.Exchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value);
224return (UIntPtr)Interlocked.Exchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value);
248object? result = Exchange(ref Unsafe.As<T, object?>(ref location1), value);
249return Unsafe.As<object?, T>(ref result);
261return Unsafe.BitCast<byte, T>(
263ref Unsafe.As<T, byte>(ref location1),
264Unsafe.BitCast<T, byte>(value)));
269return Unsafe.BitCast<ushort, T>(
271ref Unsafe.As<T, ushort>(ref location1),
272Unsafe.BitCast<T, ushort>(value)));
277return Unsafe.BitCast<int, T>(
279ref Unsafe.As<T, int>(ref location1),
280Unsafe.BitCast<T, int>(value)));
284return Unsafe.BitCast<long, T>(
286ref Unsafe.As<T, long>(ref location1),
287Unsafe.BitCast<T, long>(value)));
302(sbyte)CompareExchange(ref Unsafe.As<sbyte, byte>(ref location1), (byte)value, (byte)comparand);
313(short)CompareExchange(ref Unsafe.As<short, ushort>(ref location1), (ushort)value, (ushort)comparand);
410(uint)CompareExchange(ref Unsafe.As<uint, int>(ref location1), (int)value, (int)comparand);
422(ulong)CompareExchange(ref Unsafe.As<ulong, long>(ref location1), (long)value, (long)comparand);
432=> Unsafe.BitCast<int, float>(CompareExchange(ref Unsafe.As<float, int>(ref location1), Unsafe.BitCast<float, int>(value), Unsafe.BitCast<float, int>(comparand)));
442=> Unsafe.BitCast<long, double>(CompareExchange(ref Unsafe.As<double, long>(ref location1), Unsafe.BitCast<double, long>(value), Unsafe.BitCast<double, long>(comparand)));
456return (IntPtr)Interlocked.CompareExchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value, (long)comparand);
475return (UIntPtr)Interlocked.CompareExchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value, (long)comparand);
500object? result = CompareExchange(ref Unsafe.As<T, object?>(ref location1), value, comparand);
501return Unsafe.As<object?, T>(ref result);
513return Unsafe.BitCast<byte, T>(
515ref Unsafe.As<T, byte>(ref location1),
516Unsafe.BitCast<T, byte>(value),
517Unsafe.BitCast<T, byte>(comparand)));
522return Unsafe.BitCast<ushort, T>(
524ref Unsafe.As<T, ushort>(ref location1),
525Unsafe.BitCast<T, ushort>(value),
526Unsafe.BitCast<T, ushort>(comparand)));
531return Unsafe.BitCast<int, T>(
533ref Unsafe.As<T, int>(ref location1),
534Unsafe.BitCast<T, int>(value),
535Unsafe.BitCast<T, int>(comparand)));
539return Unsafe.BitCast<long, T>(
541ref Unsafe.As<T, long>(ref location1),
542Unsafe.BitCast<T, long>(value),
543Unsafe.BitCast<T, long>(comparand)));
556(uint)Add(ref Unsafe.As<uint, int>(ref location1), (int)value);
566(ulong)Add(ref Unsafe.As<ulong, long>(ref location1), (long)value);
576CompareExchange(ref Unsafe.AsRef(in location), 0, 0);
610(uint)And(ref Unsafe.As<uint, int>(ref location1), (int)value);
642(ulong)And(ref Unsafe.As<ulong, long>(ref location1), (long)value);
676(uint)Or(ref Unsafe.As<uint, int>(ref location1), (int)value);
708(ulong)Or(ref Unsafe.As<ulong, long>(ref location1), (long)value);
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\UInt128.cs (13)
851sourceRef = ref Unsafe.Add(ref sourceRef, source.Length - Size);
854result = Unsafe.ReadUnaligned<UInt128>(ref sourceRef);
870result |= Unsafe.Add(ref sourceRef, i);
909result = Unsafe.ReadUnaligned<UInt128>(ref sourceRef);
926UInt128 part = Unsafe.Add(ref sourceRef, i);
1144Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 0), (uint)(quotient._lower >> 00));
1145Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 1), (uint)(quotient._lower >> 32));
1147Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 2), (uint)(quotient._upper >> 00));
1148Unsafe.WriteUnaligned(ref *(byte*)(pLeft + 3), (uint)(quotient._upper >> 32));
1156Unsafe.WriteUnaligned(ref *(byte*)(pRight + 0), (uint)(divisor._lower >> 00));
1157Unsafe.WriteUnaligned(ref *(byte*)(pRight + 1), (uint)(divisor._lower >> 32));
1159Unsafe.WriteUnaligned(ref *(byte*)(pRight + 2), (uint)(divisor._upper >> 00));
1160Unsafe.WriteUnaligned(ref *(byte*)(pRight + 3), (uint)(divisor._upper >> 32));
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (23)
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);
1216Unsafe.SkipInit(out result);
1217return nuint_t.TryParse(utf8Text, style, provider, out Unsafe.As<nuint, nuint_t>(ref result));
1226Unsafe.SkipInit(out result);
1227return nuint_t.TryParse(utf8Text, provider, out Unsafe.As<nuint, nuint_t>(ref result));
src\System\Array.CoreCLR.cs (20)
165ref byte offsetDataRef = ref Unsafe.Add(ref arrayDataRef, flattenedIndex * pMethodTable->ComponentSize);
173ref object elementRef = ref Unsafe.As<byte, object>(ref arrayDataRef);
174ref object offsetElementRef = ref Unsafe.Add(ref elementRef, (nuint)flattenedIndex);
207ref byte offsetDataRef = ref Unsafe.Add(ref arrayDataRef, flattenedIndex * pMethodTable->ComponentSize);
211SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, nint>(ref offsetDataRef), elementSize / (nuint)sizeof(IntPtr));
221Unsafe.Add(ref Unsafe.As<byte, object?>(ref arrayDataRef), (nuint)flattenedIndex) = null;
230Unsafe.Add(ref Unsafe.As<byte, object?>(ref arrayDataRef), (nuint)flattenedIndex) = value;
236ref byte offsetDataRef = ref Unsafe.Add(ref arrayDataRef, flattenedIndex * pMethodTable->ComponentSize);
288public int Length => checked((int)Unsafe.As<RawArrayData>(this).Length);
291internal nuint NativeLength => Unsafe.As<RawArrayData>(this).Length;
344arrayRef = ref Unsafe.Add(ref arrayRef, elementSize);
404T[] @this = Unsafe.As<T[]>(this);
414T[] @this = Unsafe.As<T[]>(this);
422T[] @this = Unsafe.As<T[]>(this);
430T[] @this = Unsafe.As<T[]>(this);
443T[] @this = Unsafe.As<T[]>(this);
462T[] @this = Unsafe.As<T[]>(this);
483T[] @this = Unsafe.As<T[]>(this);
src\System\Runtime\CompilerServices\RuntimeHelpers.CoreCLR.cs (19)
68new ReadOnlySpan<ushort>(ref Unsafe.As<byte, ushort>(ref src), array.Length),
69new Span<ushort>(ref Unsafe.As<byte, ushort>(ref dst), array.Length));
73new ReadOnlySpan<uint>(ref Unsafe.As<byte, uint>(ref src), array.Length),
74new Span<uint>(ref Unsafe.As<byte, uint>(ref dst), array.Length));
78new ReadOnlySpan<ulong>(ref Unsafe.As<byte, ulong>(ref src), array.Length),
79new Span<ulong>(ref Unsafe.As<byte, ulong>(ref dst), array.Length));
391ref Unsafe.As<RawData>(obj).Data;
401rawSize += (uint)Unsafe.As<RawArrayData>(obj).Length * (nuint)pMT->ComponentSize;
422return ref Unsafe.As<byte, int>(ref Unsafe.As<RawArrayData>(array).Data);
576/// This API returns the same value as <see cref="Unsafe.SizeOf{T}"/> for the type that <paramref name="type"/> represents.
631private MethodDescChunk* GetMethodDescChunk() => (MethodDescChunk*)(((byte*)Unsafe.AsPointer<MethodDesc>(ref this)) - (sizeof(MethodDescChunk) + ChunkIndex * sizeof(IntPtr)));
962return *(RuntimeType*)Unsafe.AsPointer(ref _exposedClassObject);
984return ref Unsafe.AsRef<byte>((byte*)((nuint)p & ~(nuint)DynamicStaticsInfo.ISCLASSNOTINITED));
1061return *(RuntimeType*)Unsafe.AsPointer(ref ExposedClassObjectRaw);
1074return ref Unsafe.Subtract(ref Unsafe.As<MethodTableAuxiliaryData, DynamicStaticsInfo>(ref this), 1);
1082return ref Unsafe.Subtract(ref Unsafe.As<MethodTableAuxiliaryData, ThreadStaticsInfo>(ref this), 1);
src\System\Runtime\InteropServices\Marshal.CoreCLR.cs (5)
263structMarshalStub(ref structure.GetRawData(), (byte*)ptr, MarshalOperation.Cleanup, ref Unsafe.NullRef<CleanupWorkListElement?>());
266structMarshalStub(ref structure.GetRawData(), (byte*)ptr, MarshalOperation.Marshal, ref Unsafe.NullRef<CleanupWorkListElement?>());
291structMarshalStub(ref structure.GetRawData(), (byte*)ptr, MarshalOperation.Unmarshal, ref Unsafe.NullRef<CleanupWorkListElement?>());
325structMarshalStub(ref Unsafe.NullRef<byte>(), (byte*)ptr, MarshalOperation.Cleanup, ref Unsafe.NullRef<CleanupWorkListElement?>());
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);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (24)
48Unsafe.Add(ref destination, 1) = (byte)(value >> 8);
49Unsafe.Add(ref destination, 2) = (byte)value;
56int i1 = Unsafe.Add(ref encodedChars, 1);
57int i2 = Unsafe.Add(ref encodedChars, 2);
58int i3 = Unsafe.Add(ref encodedChars, 3);
63i0 = Unsafe.Add(ref decodingMap, i0);
64i1 = Unsafe.Add(ref decodingMap, i1);
65i2 = Unsafe.Add(ref decodingMap, i2);
66i3 = Unsafe.Add(ref decodingMap, i3);
227int result = Decode(ref Unsafe.Add(ref srcChars, sourceIndex), ref decodingMap);
230WriteThreeLowOrderBytes(ref Unsafe.Add(ref destBytes, destIndex), result);
245int i0 = Unsafe.Add(ref srcChars, srcLength - 4);
246int i1 = Unsafe.Add(ref srcChars, srcLength - 3);
247int i2 = Unsafe.Add(ref srcChars, srcLength - 2);
248int i3 = Unsafe.Add(ref srcChars, srcLength - 1);
252i0 = Unsafe.Add(ref decodingMap, i0);
253i1 = Unsafe.Add(ref decodingMap, i1);
262i2 = Unsafe.Add(ref decodingMap, i2);
263i3 = Unsafe.Add(ref decodingMap, i3);
274WriteThreeLowOrderBytes(ref Unsafe.Add(ref destBytes, destIndex), i0);
279i2 = Unsafe.Add(ref decodingMap, i2);
289Unsafe.Add(ref destBytes, destIndex) = (byte)(i0 >> 16);
290Unsafe.Add(ref destBytes, destIndex + 1) = (byte)(i0 >> 8);
299Unsafe.Add(ref destBytes, destIndex) = (byte)(i0 >> 16);