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/runtime/intrinsics/Vector.cs | |
parent | Refactoring in tests (diff) | |
download | BouncyCastle.NET-ed25519-df651f2abe8711de81ffb4d7e0fddee36a298e70.tar.xz |
Create indirection layer for intrinsics support
Diffstat (limited to 'crypto/src/runtime/intrinsics/Vector.cs')
-rw-r--r-- | crypto/src/runtime/intrinsics/Vector.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/src/runtime/intrinsics/Vector.cs b/crypto/src/runtime/intrinsics/Vector.cs new file mode 100644 index 000000000..eff52ef44 --- /dev/null +++ b/crypto/src/runtime/intrinsics/Vector.cs @@ -0,0 +1,24 @@ +#if NETCOREAPP3_0_OR_GREATER +using System; +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +#endif + +namespace Org.BouncyCastle.Runtime.Intrinsics +{ + internal static class Vector + { +#if NETCOREAPP3_0_OR_GREATER + internal static bool IsPacked => + Unsafe.SizeOf<Vector64<byte>>() == 8 && + Unsafe.SizeOf<Vector128<byte>>() == 16 && + Unsafe.SizeOf<Vector256<byte>>() == 32; + + internal static bool IsPackedLittleEndian => IsPacked && BitConverter.IsLittleEndian; +#else + internal static bool IsPacked => false; + + internal static bool IsPackedLittleEndian => false; +#endif + } +} |