@@ -42,48 +42,6 @@ public static long Decrement(ref long location) =>
4242 #endregion
4343
4444 #region Exchange
45- /// <summary>Sets a 8-bit unsigned integer to a specified value and returns the original value, as an atomic operation.</summary>
46- /// <param name="location1">The variable to set to the specified value.</param>
47- /// <param name="value">The value to which the <paramref name="location1"/> parameter is set.</param>
48- /// <returns>The original value of <paramref name="location1"/>.</returns>
49- /// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception>
50- [ Intrinsic ]
51- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
52- public static byte Exchange ( ref byte location1 , byte value )
53- {
54- #if TARGET_X86 || TARGET_AMD64 || TARGET_ARM64
55- return Exchange ( ref location1 , value ) ; // Must expand intrinsic
56- #else
57- if ( Unsafe . IsNullRef ( ref location1 ) )
58- ThrowHelper . ThrowNullReferenceException ( ) ;
59- return Exchange8 ( ref location1 , value ) ;
60- #endif
61- }
62-
63- [ MethodImpl ( MethodImplOptions . InternalCall ) ]
64- private static extern byte Exchange8 ( ref byte location1 , byte value ) ;
65-
66- /// <summary>Sets a 16-bit signed integer to a specified value and returns the original value, as an atomic operation.</summary>
67- /// <param name="location1">The variable to set to the specified value.</param>
68- /// <param name="value">The value to which the <paramref name="location1"/> parameter is set.</param>
69- /// <returns>The original value of <paramref name="location1"/>.</returns>
70- /// <exception cref="NullReferenceException">The address of location1 is a null pointer.</exception>
71- [ Intrinsic ]
72- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
73- public static short Exchange ( ref short location1 , short value )
74- {
75- #if TARGET_X86 || TARGET_AMD64 || TARGET_ARM64
76- return Exchange ( ref location1 , value ) ; // Must expand intrinsic
77- #else
78- if ( Unsafe . IsNullRef ( ref location1 ) )
79- ThrowHelper . ThrowNullReferenceException ( ) ;
80- return Exchange16 ( ref location1 , value ) ;
81- #endif
82- }
83-
84- [ MethodImpl ( MethodImplOptions . InternalCall ) ]
85- private static extern short Exchange16 ( ref short location1 , short value ) ;
86-
8745 /// <summary>Sets a 32-bit signed integer to a specified value and returns the original value, as an atomic operation.</summary>
8846 /// <param name="location1">The variable to set to the specified value.</param>
8947 /// <param name="value">The value to which the <paramref name="location1"/> parameter is set.</param>
@@ -162,50 +120,6 @@ public static T Exchange<T>([NotNullIfNotNull(nameof(value))] ref T location1, T
162120#endregion
163121
164122 #region CompareExchange
165- /// <summary>Compares two 8-bit unsigned integers for equality and, if they are equal, replaces the first value.</summary>
166- /// <param name="location1">The destination, whose value is compared with <paramref name="comparand"/> and possibly replaced.</param>
167- /// <param name="value">The value that replaces the destination value if the comparison results in equality.</param>
168- /// <param name="comparand">The value that is compared to the value at <paramref name="location1"/>.</param>
169- /// <returns>The original value in <paramref name="location1"/>.</returns>
170- /// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception>
171- [ Intrinsic ]
172- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
173- public static byte CompareExchange ( ref byte location1 , byte value , byte comparand )
174- {
175- #if TARGET_X86 || TARGET_AMD64 || TARGET_ARM64
176- return CompareExchange ( ref location1 , value , comparand ) ; // Must expand intrinsic
177- #else
178- if ( Unsafe . IsNullRef ( ref location1 ) )
179- ThrowHelper . ThrowNullReferenceException ( ) ;
180- return CompareExchange8 ( ref location1 , value , comparand ) ;
181- #endif
182- }
183-
184- [ MethodImpl ( MethodImplOptions . InternalCall ) ]
185- private static extern byte CompareExchange8 ( ref byte location1 , byte value , byte comparand ) ;
186-
187- /// <summary>Compares two 16-bit signed integers for equality and, if they are equal, replaces the first value.</summary>
188- /// <param name="location1">The destination, whose value is compared with <paramref name="comparand"/> and possibly replaced.</param>
189- /// <param name="value">The value that replaces the destination value if the comparison results in equality.</param>
190- /// <param name="comparand">The value that is compared to the value at <paramref name="location1"/>.</param>
191- /// <returns>The original value in <paramref name="location1"/>.</returns>
192- /// <exception cref="NullReferenceException">The address of <paramref name="location1"/> is a null pointer.</exception>
193- [ Intrinsic ]
194- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
195- public static short CompareExchange ( ref short location1 , short value , short comparand )
196- {
197- #if TARGET_X86 || TARGET_AMD64 || TARGET_ARM64
198- return CompareExchange ( ref location1 , value , comparand ) ; // Must expand intrinsic
199- #else
200- if ( Unsafe . IsNullRef ( ref location1 ) )
201- ThrowHelper . ThrowNullReferenceException ( ) ;
202- return CompareExchange16 ( ref location1 , value , comparand ) ;
203- #endif
204- }
205-
206- [ MethodImpl ( MethodImplOptions . InternalCall ) ]
207- private static extern short CompareExchange16 ( ref short location1 , short value , short comparand ) ;
208-
209123 /// <summary>Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.</summary>
210124 /// <param name="location1">The destination, whose value is compared with <paramref name="comparand"/> and possibly replaced.</param>
211125 /// <param name="value">The value that replaces the destination value if the comparison results in equality.</param>
0 commit comments