@@ -101,7 +101,11 @@ public static Vector128<TTo> As<TFrom, TTo>(this Vector128<TFrom> vector)
101
101
ThrowHelper . ThrowForUnsupportedIntrinsicsVector128BaseType < TFrom > ( ) ;
102
102
ThrowHelper . ThrowForUnsupportedIntrinsicsVector128BaseType < TTo > ( ) ;
103
103
104
+ #if MONO
105
+ return Unsafe . As < Vector128 < TFrom > , Vector128 < TTo > > ( ref vector ) ;
106
+ #else
104
107
return Unsafe . BitCast < Vector128 < TFrom > , Vector128 < TTo > > ( vector ) ;
108
+ #endif
105
109
}
106
110
107
111
/// <summary>Reinterprets a <see cref="Vector128{T}" /> as a new <see cref="Vector128{Byte}" />.</summary>
@@ -164,12 +168,26 @@ public static Vector128<TTo> As<TFrom, TTo>(this Vector128<TFrom> vector)
164
168
/// <summary>Reinterprets a <see cref="Vector128{Single}" /> as a new <see cref="Plane" />.</summary>
165
169
/// <param name="value">The vector to reinterpret.</param>
166
170
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Plane" />.</returns>
167
- internal static Plane AsPlane ( this Vector128 < float > value ) => Unsafe . BitCast < Vector128 < float > , Plane > ( value ) ;
171
+ internal static Plane AsPlane ( this Vector128 < float > value )
172
+ {
173
+ #if MONO
174
+ return Unsafe . As < Vector128 < float > , Plane > ( ref value ) ;
175
+ #else
176
+ return Unsafe . BitCast < Vector128 < float > , Plane > ( value ) ;
177
+ #endif
178
+ }
168
179
169
180
/// <summary>Reinterprets a <see cref="Vector128{Single}" /> as a new <see cref="Quaternion" />.</summary>
170
181
/// <param name="value">The vector to reinterpret.</param>
171
182
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Quaternion" />.</returns>
172
- internal static Quaternion AsQuaternion ( this Vector128 < float > value ) => Unsafe . BitCast < Vector128 < float > , Quaternion > ( value ) ;
183
+ internal static Quaternion AsQuaternion ( this Vector128 < float > value )
184
+ {
185
+ #if MONO
186
+ return Unsafe . As < Vector128 < float > , Quaternion > ( ref value ) ;
187
+ #else
188
+ return Unsafe . BitCast < Vector128 < float > , Quaternion > ( value ) ;
189
+ #endif
190
+ }
173
191
174
192
/// <summary>Reinterprets a <see cref="Vector128{T}" /> as a new <see cref="Vector128{SByte}" />.</summary>
175
193
/// <typeparam name="T">The type of the elements in the vector.</typeparam>
@@ -218,12 +236,28 @@ public static Vector128<TTo> As<TFrom, TTo>(this Vector128<TFrom> vector)
218
236
/// <summary>Reinterprets a <see cref="Plane" /> as a new <see cref="Vector128{Single}" />.</summary>
219
237
/// <param name="value">The plane to reinterpret.</param>
220
238
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector128{Single}" />.</returns>
221
- internal static Vector128 < float > AsVector128 ( this Plane value ) => Unsafe . BitCast < Plane , Vector128 < float > > ( value ) ;
239
+ [ Intrinsic ]
240
+ internal static Vector128 < float > AsVector128 ( this Plane value )
241
+ {
242
+ #if MONO
243
+ return Unsafe . As < Plane , Vector128 < float > > ( ref value ) ;
244
+ #else
245
+ return Unsafe . BitCast < Plane , Vector128 < float > > ( value ) ;
246
+ #endif
247
+ }
222
248
223
249
/// <summary>Reinterprets a <see cref="Quaternion" /> as a new <see cref="Vector128{Single}" />.</summary>
224
250
/// <param name="value">The quaternion to reinterpret.</param>
225
251
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector128{Single}" />.</returns>
226
- internal static Vector128 < float > AsVector128 ( this Quaternion value ) => Unsafe . BitCast < Quaternion , Vector128 < float > > ( value ) ;
252
+ [ Intrinsic ]
253
+ internal static Vector128 < float > AsVector128 ( this Quaternion value )
254
+ {
255
+ #if MONO
256
+ return Unsafe . As < Quaternion , Vector128 < float > > ( ref value ) ;
257
+ #else
258
+ return Unsafe . BitCast < Quaternion , Vector128 < float > > ( value ) ;
259
+ #endif
260
+ }
227
261
228
262
/// <summary>Reinterprets a <see cref="Vector2" /> as a new <see cref="Vector128{Single}" />.</summary>
229
263
/// <param name="value">The vector to reinterpret.</param>
@@ -241,7 +275,14 @@ public static Vector128<TTo> As<TFrom, TTo>(this Vector128<TFrom> vector)
241
275
/// <param name="value">The vector to reinterpret.</param>
242
276
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector128{Single}" />.</returns>
243
277
[ Intrinsic ]
244
- public static Vector128 < float > AsVector128 ( this Vector4 value ) => Unsafe . BitCast < Vector4 , Vector128 < float > > ( value ) ;
278
+ public static Vector128 < float > AsVector128 ( this Vector4 value )
279
+ {
280
+ #if MONO
281
+ return Unsafe . As < Vector4 , Vector128 < float > > ( ref value ) ;
282
+ #else
283
+ return Unsafe . BitCast < Vector4 , Vector128 < float > > ( value ) ;
284
+ #endif
285
+ }
245
286
246
287
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector128{T}" />.</summary>
247
288
/// <typeparam name="T">The type of the elements in the vector.</typeparam>
@@ -285,7 +326,14 @@ public static Vector3 AsVector3(this Vector128<float> value)
285
326
/// <param name="value">The vector to reinterpret.</param>
286
327
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector4" />.</returns>
287
328
[ Intrinsic ]
288
- public static Vector4 AsVector4 ( this Vector128 < float > value ) => Unsafe . BitCast < Vector128 < float > , Vector4 > ( value ) ;
329
+ public static Vector4 AsVector4 ( this Vector128 < float > value )
330
+ {
331
+ #if MONO
332
+ return Unsafe . As < Vector128 < float > , Vector4 > ( ref value ) ;
333
+ #else
334
+ return Unsafe . BitCast < Vector128 < float > , Vector4 > ( value ) ;
335
+ #endif
336
+ }
289
337
290
338
/// <summary>Reinterprets a <see cref="Vector128{T}" /> as a new <see cref="Vector{T}" />.</summary>
291
339
/// <typeparam name="T">The type of the elements in the vector.</typeparam>
0 commit comments