Skip to content

Commit

Permalink
Use Unsafe.ReadUnaligned for the software fallback of Vector256.AsVec…
Browse files Browse the repository at this point in the history
…tor()
  • Loading branch information
tannergooding committed Sep 28, 2022
1 parent 4146f92 commit ebaf95a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ public static Vector<T> AsVector<T>(this Vector256<T> value)
{
Debug.Assert(Vector256<T>.Count >= Vector<T>.Count);
ThrowHelper.ThrowForUnsupportedIntrinsicsVector256BaseType<T>();
return Unsafe.As<Vector256<T>, Vector<T>>(ref value);

ref byte address = ref Unsafe.As<Vector256<T>, byte>(ref value);
return Unsafe.ReadUnaligned<Vector<T>>(ref address);
}

/// <summary>Computes the bitwise-and of two vectors.</summary>
Expand Down

0 comments on commit ebaf95a

Please sign in to comment.