196 references to Add
System.Linq (1)
System\Linq\Sum.cs (1)
185checked { result += Unsafe.Add(ref ptr, index); }
System.Numerics.Tensors (23)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (3)
144result = TAggregationOperator.Invoke(result, transform.Invoke(Unsafe.Add(ref xRef, i))); 1263result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, i), 1264Unsafe.Add(ref yRef, i)));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (5)
149Unsafe.Add(ref dRef, i) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, i), 150Unsafe.Add(ref yRef, i)); 1481Unsafe.Add(ref dRef, i) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, i)),
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IStatefulUnaryOperator.cs (2)
115Unsafe.Add(ref dRef, i) = op.Invoke(Unsafe.Add(ref xRef, i));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.ITernaryOperator.cs (9)
136Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 137Unsafe.Add(ref yRef, i), 138Unsafe.Add(ref zRef, i)); 1611Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 1612Unsafe.Add(ref yRef, i), 3097Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i),
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOperator.cs (2)
155Unsafe.Add(ref dRef, i) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, i));
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (1)
104? ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (uint)start)
System\Numerics\Tensors\netcore\TensorSpan_1.cs (1)
72? ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (uint)start)
System.Private.CoreLib (172)
src\libraries\Common\src\System\HexConverter.cs (2)
140uint i32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref srcRef, pos)); 334Unsafe.WriteUnaligned(ref Unsafe.Add(ref destRef, offset / 2), output.AsUInt64().ToScalar());
src\libraries\System.Private.CoreLib\src\System\Array.cs (2)
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);
src\libraries\System.Private.CoreLib\src\System\Collections\BitArray.cs (3)
179Unsafe.WriteUnaligned(ref Unsafe.Add(ref arrayRef, sizeof(ulong) * (i / 64u)), ~result); 190Unsafe.WriteUnaligned(ref Unsafe.Add(ref arrayRef, sizeof(uint) * (i / 32u)), ~result); 206ref Unsafe.Add(ref arrayRef, sizeof(uint) * (i / 32u)),
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (3)
155ref Unsafe.Add(ref charA, i), (int)(lengthU - i), 156ref Unsafe.Add(ref charB, i), (int)(lengthU - i)) == 0; 418ref Unsafe.Add(ref searchSpace, (nuint)(offset + 1)),
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.Utf8.cs (8)
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 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
src\libraries\System.Private.CoreLib\src\System\Memory.cs (1)
345refToReturn = ref Unsafe.Add(ref refToReturn, desiredStartIndex);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (3)
1575ref Unsafe.Add(ref MemoryMarshal.GetReference(typeof(TChar) == typeof(char) ? TwoDigitsCharsAsBytes : TwoDigitsBytes), (uint)sizeof(TChar) * 2 * value), 1595ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * value), 1600ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * remainder),
src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (1)
267refToReturn = ref Unsafe.Add(ref refToReturn, desiredStartIndex);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (1)
3859ref byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref destination, elementOffset));
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (4)
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;
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (1)
88return Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(hashEntries), (nuint)offset) == value;
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasick.cs (4)
128ref AhoCorasickNode node = ref Unsafe.Add(ref nodes, (uint)nodeIndex); 136int matchLength = Unsafe.Add(ref nodes, (uint)nodeIndex).MatchLength; 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\RabinKarp.cs (4)
120ref char end = ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (uint)(span.Length - hashLength)); 125hash = (hash << HashShiftPerElement) + TCaseSensitivity.TransformInput(Unsafe.Add(ref current, i)); 135if (Unsafe.Add(ref bucketsRef, hash % BucketCount) is string[] bucket) 151char next = TCaseSensitivity.TransformInput(Unsafe.Add(ref current, (uint)hashLength));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Byte.cs (8)
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;
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.ByteMemOps.cs (6)
46ref byte srcEnd = ref Unsafe.Add(ref src, len); 47ref byte destEnd = ref Unsafe.Add(ref dest, len); 164src = ref Unsafe.Add(ref src, misalignedElements); 165dest = ref Unsafe.Add(ref dest, misalignedElements); 251ref byte destEnd = ref Unsafe.Add(ref dest, len); 365dest = ref Unsafe.Add(ref dest, misalignedElements);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.cs (1)
336ref T last = ref Unsafe.Subtract(ref Unsafe.Add(ref first, length), 1);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Packed.cs (4)
137if (Unsafe.Add(ref searchSpace, offset) == value) 338if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset)) == value)) return (int)offset; 547lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset)); 761lookUp = Unsafe.Add(ref searchSpace, offset);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (74)
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)); 1403ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector256<T>.Count)); 1433ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector128<T>.Count)); 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; 1718ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1744ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1761lookUp = Unsafe.Add(ref searchSpace, offset); 1925ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1951ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 1968lookUp = Unsafe.Add(ref searchSpace, offset); 2115ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2132lookUp = Unsafe.Add(ref searchSpace, offset); 2277ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2294lookUp = Unsafe.Add(ref searchSpace, offset); 2315ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector512<TValue>.Count)); 2350ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector256<TValue>.Count)); 2385ref TValue oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector128<TValue>.Count)); 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); 2591ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2608lookUp = Unsafe.Add(ref searchSpace, offset); 2750ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2776ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 2793lookUp = Unsafe.Add(ref searchSpace, offset); 2934ref TValue current = ref Unsafe.Add(ref searchSpace, offset); 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); 3218lookUp = Unsafe.Add(ref searchSpace, offset); 3520ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector128<T>.Count)); 3549ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector256<T>.Count)); 3578ref T oneVectorAwayFromEnd = ref Unsafe.Add(ref searchSpace, (uint)(length - Vector512<T>.Count));
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (3)
1293ref ushort pSrc = ref Unsafe.Add(ref GetRawStringDataAsUInt16(), (uint)copyLength); 1294ref ushort pDst = ref Unsafe.Add(ref result.GetRawStringDataAsUInt16(), (uint)copyLength); 2133char curr = Unsafe.Add(ref source, offset);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.cs (9)
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))) | 152ref T current = ref Unsafe.Add(ref searchSpace, i); 164searchSpace = ref Unsafe.Add(ref searchSpace, finalStart); 204ref T current = ref Unsafe.Add(ref searchSpace, i); 216searchSpace = ref Unsafe.Add(ref searchSpace, finalStart);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Equality.cs (24)
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); 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); 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); 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); 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); 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);
src\System\Array.CoreCLR.cs (4)
174ref object offsetElementRef = ref Unsafe.Add(ref elementRef, (nuint)flattenedIndex); 221Unsafe.Add(ref Unsafe.As<byte, object?>(ref arrayDataRef), (nuint)flattenedIndex) = null; 230Unsafe.Add(ref Unsafe.As<byte, object?>(ref arrayDataRef), (nuint)flattenedIndex) = value; 344arrayRef = ref Unsafe.Add(ref arrayRef, elementSize);
src\System\Runtime\CompilerServices\CastHelpers.cs (2)
539ref byte srcValue = ref Unsafe.Add(ref nullableData, srcMT->NullableValueAddrOffset); 651ref byte dst = ref Unsafe.Add(ref destPtr, typeMT->NullableValueAddrOffset);