diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-11-06 17:25:12 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-11-06 17:25:12 +0700 |
commit | df651f2abe8711de81ffb4d7e0fddee36a298e70 (patch) | |
tree | 666aba534a9373a76489d48eccc5557d4eb4406b /crypto/src/math/raw/Nat256.cs | |
parent | Refactoring in tests (diff) | |
download | BouncyCastle.NET-ed25519-df651f2abe8711de81ffb4d7e0fddee36a298e70.tar.xz |
Create indirection layer for intrinsics support
Diffstat (limited to 'crypto/src/math/raw/Nat256.cs')
-rw-r--r-- | crypto/src/math/raw/Nat256.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/src/math/raw/Nat256.cs b/crypto/src/math/raw/Nat256.cs index 59039d3fa..49adf04af 100644 --- a/crypto/src/math/raw/Nat256.cs +++ b/crypto/src/math/raw/Nat256.cs @@ -1865,7 +1865,8 @@ namespace Org.BouncyCastle.Math.Raw public static void Xor(ReadOnlySpan<uint> x, ReadOnlySpan<uint> y, Span<uint> z) { #if NETCOREAPP3_0_OR_GREATER - if (Avx2.IsSupported && Unsafe.SizeOf<Vector256<byte>>() == 32) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Avx2.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked) { var X = MemoryMarshal.AsBytes(x[..8]); var Y = MemoryMarshal.AsBytes(y[..8]); @@ -1880,7 +1881,8 @@ namespace Org.BouncyCastle.Math.Raw return; } - if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == 16) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Sse2.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked) { var X = MemoryMarshal.AsBytes(x[..8]); var Y = MemoryMarshal.AsBytes(y[..8]); |