211 references to Add
System.Linq (1)
System\Linq\Sum.cs (1)
185checked { result += Unsafe.Add(ref ptr, index); }
System.Numerics.Tensors (26)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (3)
118result = TAggregationOperator.Invoke(result, TTransformOperator.Invoke(Unsafe.Add(ref xRef, i))); 1199result = TAggregationOperator.Invoke(result, TBinaryOperator.Invoke(Unsafe.Add(ref xRef, i), 1200Unsafe.Add(ref yRef, i)));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (5)
151Unsafe.Add(ref dRef, i) = TBinaryOperator.Invoke(Unsafe.Add(ref xRef, i), 152Unsafe.Add(ref yRef, i)); 1483Unsafe.Add(ref dRef, i) = TBinaryOperator.Invoke(TTransformOperator.Invoke(Unsafe.Add(ref xRef, i)),
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IStatefulUnaryOperator.cs (2)
117Unsafe.Add(ref dRef, i) = op.Invoke(Unsafe.Add(ref xRef, i));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.ITernaryOperator.cs (10)
127Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 128Unsafe.Add(ref yRef, i), 129Unsafe.Add(ref zRef, i)); 1602Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 1603Unsafe.Add(ref yRef, i), 3081Unsafe.Add(ref dRef, i) = TTernaryOperator.Invoke(Unsafe.Add(ref xRef, i), 3083Unsafe.Add(ref zRef, i));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOperator.cs (2)
157Unsafe.Add(ref dRef, i) = TUnaryOperator.Invoke(Unsafe.Add(ref xRef, i));
System\Numerics\Tensors\netcore\TensorSpanHelpers.T.cs (4)
45dest = ref Unsafe.Add(ref dest, toClear); 56dest = ref Unsafe.Add(ref dest, toFill); 68first = ref Unsafe.Add(ref first, toCompare); 69second = ref Unsafe.Add(ref second, toCompare);
System.Private.CoreLib (184)
src\libraries\Common\src\System\HexConverter.cs (2)
138uint i32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref srcRef, pos)); 307Unsafe.WriteUnaligned(ref Unsafe.Add(ref destRef, offset / 2), output.AsUInt64().ToScalar());
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (9)
408int i0 = Unsafe.Add(ref decodingMap, t0); 409int i1 = Unsafe.Add(ref decodingMap, t1); 418int i2 = Unsafe.Add(ref decodingMap, t2); 419int i3 = Unsafe.Add(ref decodingMap, t3); 436int i2 = Unsafe.Add(ref decodingMap, t2); 1176int i0 = Unsafe.Add(ref decodingMap, t0); 1177int i1 = Unsafe.Add(ref decodingMap, t1); 1178int i2 = Unsafe.Add(ref decodingMap, t2); 1179int i3 = Unsafe.Add(ref decodingMap, t3);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (2)
56ulong powerOf10 = Unsafe.Add(ref MemoryMarshal.GetReference(powersOf10), index); 106long tableValue = Unsafe.Add(ref MemoryMarshal.GetReference(table), uint.Log2(value));
src\libraries\System.Private.CoreLib\src\System\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\Number.Formatting.cs (3)
1814ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(typeof(TChar) == typeof(char) ? TwoDigitsCharsAsBytes : TwoDigitsBytes), (uint)sizeof(TChar) * 2 * value), 1834ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * value), 1839ref Unsafe.Add(ref charsArray, (uint)sizeof(TChar) * 2 * remainder),
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (1)
2757ref byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref destination, elementOffset));
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (4)
82Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) |= (byte)(1u << (value >> VectorizedIndexShift)); 86Unsafe.Add(ref charMap, value & PortableIndexMask) |= 1u << (value >> PortableIndexShift); 92? (Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) & (1u << (value >> VectorizedIndexShift))) != 0 93: (Unsafe.Add(ref charMap, value & PortableIndexMask) & (1u << (value >> PortableIndexShift))) != 0;
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (1)
90return 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\SearchValues\Strings\Helpers\StringSearchValuesHelper.cs (8)
153differentBits |= Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref first, offset)) - Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref second, offset)); 164return Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref first, offset)) 165== Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref second, offset)); 207differentBits |= (Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref first, offset)) & CaseMask) - Unsafe.ReadUnaligned<ulong>(ref Unsafe.Add(ref second, offset)); 215differentBits |= (Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref first, offset)) & CaseMask) - Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref second, offset));
src\libraries\System.Private.CoreLib\src\System\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)
49ref byte srcEnd = ref Unsafe.Add(ref src, len); 50ref byte destEnd = ref Unsafe.Add(ref dest, len); 167src = ref Unsafe.Add(ref src, misalignedElements); 168dest = ref Unsafe.Add(ref dest, misalignedElements); 257ref byte destEnd = ref Unsafe.Add(ref dest, len); 371dest = ref Unsafe.Add(ref dest, misalignedElements);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.cs (1)
338ref T last = ref Unsafe.Subtract(ref Unsafe.Add(ref first, length), 1);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Packed.cs (4)
139if (Unsafe.Add(ref searchSpace, offset) == value) 340if (TNegator.NegateIfNeeded(TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset)) == value)) return (int)offset; 549lookUp = TTransform.TransformInput(Unsafe.Add(ref searchSpace, offset)); 763lookUp = 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)
1291ref ushort pSrc = ref Unsafe.Add(ref GetRawStringDataAsUInt16(), (uint)copyLength); 1292ref ushort pDst = ref Unsafe.Add(ref result.GetRawStringDataAsUInt16(), (uint)copyLength); 2134char 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)
55uint valueA = uint.CreateTruncating(Unsafe.Add(ref left, i)); 56uint valueB = uint.CreateTruncating(Unsafe.Add(ref right, i)); 72ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector512<TLeft>.Count); 90ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector512<TLeft>.Count); 102ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector256<TLeft>.Count); 120ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref left, length - (uint)Vector256<TLeft>.Count); 127ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count128); 129ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector128<TRight>.Count); 146currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector128<TRight>.Count); 147currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count128); 209uint valueA = uint.CreateTruncating(Unsafe.Add(ref left, i)); 210uint valueB = uint.CreateTruncating(Unsafe.Add(ref right, i)); 237ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count512); 239ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector512<TRight>.Count); 273currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector512<TRight>.Count); 274currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count512); 308ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count256); 310ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector256<TRight>.Count); 345currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector256<TRight>.Count); 346currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count256); 380ref TLeft oneVectorAwayFromLeftEnd = ref Unsafe.Add(ref currentLeftSearchSpace, length - TLoader.Count128); 382ref TRight oneVectorAwayFromRightEnd = ref Unsafe.Add(ref currentRightSearchSpace, length - (uint)Vector128<TRight>.Count); 418currentRightSearchSpace = ref Unsafe.Add(ref currentRightSearchSpace, (uint)Vector128<TRight>.Count); 419currentLeftSearchSpace = ref Unsafe.Add(ref currentLeftSearchSpace, TLoader.Count128);
src\System\Array.CoreCLR.cs (6)
244ref byte srcData = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(sourceArray), (nuint)sourceIndex * srcElSize); 245ref byte data = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(destinationArray), (nuint)destinationIndex * destElSize); 249ref byte srcElement = ref Unsafe.Add(ref srcData, (nuint)i * srcElSize); 250ref byte destElement = ref Unsafe.Add(ref data, (nuint)i * destElSize); 547ref object offsetElementRef = ref Unsafe.Add(ref elementRef, (nuint)flattenedIndex); 658arrayRef = ref Unsafe.Add(ref arrayRef, elementSize);