From df651f2abe8711de81ffb4d7e0fddee36a298e70 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 6 Nov 2023 17:25:12 +0700 Subject: Create indirection layer for intrinsics support --- crypto/src/runtime/intrinsics/Vector.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 crypto/src/runtime/intrinsics/Vector.cs (limited to 'crypto/src/runtime/intrinsics/Vector.cs') 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>() == 8 && + Unsafe.SizeOf>() == 16 && + Unsafe.SizeOf>() == 32; + + internal static bool IsPackedLittleEndian => IsPacked && BitConverter.IsLittleEndian; +#else + internal static bool IsPacked => false; + + internal static bool IsPackedLittleEndian => false; +#endif + } +} -- cgit 1.4.1