summary refs log tree commit diff
path: root/crypto/src/runtime/intrinsics/Vector.cs
blob: eff52ef44024fe0080c4df366117d5eb6d426fbc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
    }
}