Skip to content

Instantly share code, notes, and snippets.

@richlander
Last active January 29, 2019 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richlander/eb4d5b24746f1bd317738d8ad4c4b0e8 to your computer and use it in GitHub Desktop.
Save richlander/eb4d5b24746f1bd317738d8ad4c4b0e8 to your computer and use it in GitHub Desktop.
Using Unsafe APIs
Vector256<short> SoftwareFallback(short x)
{
var result = Vector256<short>.Zero;
Unsafe.WriteUnaligned(ref Unsafe.As<Vector256<short>, byte>(ref result), value);
return result;
}
// https://github.com/dotnet/coreclr/blob/57fd77e6f8f7f2c37cc5c3b36df3ea4f302e143b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs#L1303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment