diff options
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64DebugView.cs')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64DebugView.cs | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64DebugView.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64DebugView.cs new file mode 100644 index 000000000..878e29949 --- /dev/null +++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64DebugView.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Internal.Runtime.CompilerServices; + +namespace System.Runtime.Intrinsics +{ + internal readonly struct Vector64DebugView<T> where T : struct + { + private readonly Vector64<T> _value; + + public Vector64DebugView(Vector64<T> value) + { + _value = value; + } + + public byte[] ByteView + { + get + { + var items = new byte[8]; + Unsafe.WriteUnaligned(ref items[0], _value); + return items; + } + } + + public double[] DoubleView + { + get + { + var items = new double[1]; + Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); + return items; + } + } + + public short[] Int16View + { + get + { + var items = new short[4]; + Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); + return items; + } + } + + public int[] Int32View + { + get + { + var items = new int[2]; + Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); + return items; + } + } + + public long[] Int64View + { + get + { + var items = new long[1]; + Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); + return items; + } + } + + public sbyte[] SByteView + { + get + { + var items = new sbyte[8]; + Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); + return items; + } + } + + public float[] SingleView + { + get + { + var items = new float[2]; + Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); + return items; + } + } + + public ushort[] UInt16View + { + get + { + var items = new ushort[4]; + Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); + return items; + } + } + + public uint[] UInt32View + { + get + { + var items = new uint[2]; + Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); + return items; + } + } + + public ulong[] UInt64View + { + get + { + var items = new ulong[1]; + Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value); + return items; + } + } + } +} |