[System.Numerics.Vectors] Enable Vector on desktop profile
[mono-project.git] / mcs / class / System.Numerics.Vectors / System.Numerics / ConstantHelper.cs
blobea32ed3803f44d9427ce019612aa5e98b893c769
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System.Runtime.CompilerServices;
7 namespace System.Numerics
9 internal class ConstantHelper
11 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
12 public static Byte GetByteWithAllBitsSet()
14 Byte value = 0;
15 unsafe
17 unchecked
19 *((Byte*)&value) = (Byte)0xff;
22 return value;
24 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
25 public static SByte GetSByteWithAllBitsSet()
27 SByte value = 0;
28 unsafe
30 unchecked
32 *((SByte*)&value) = (SByte)0xff;
35 return value;
37 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
38 public static UInt16 GetUInt16WithAllBitsSet()
40 UInt16 value = 0;
41 unsafe
43 unchecked
45 *((UInt16*)&value) = (UInt16)0xffff;
48 return value;
50 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
51 public static Int16 GetInt16WithAllBitsSet()
53 Int16 value = 0;
54 unsafe
56 unchecked
58 *((Int16*)&value) = (Int16)0xffff;
61 return value;
63 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
64 public static UInt32 GetUInt32WithAllBitsSet()
66 UInt32 value = 0;
67 unsafe
69 unchecked
71 *((UInt32*)&value) = (UInt32)0xffffffff;
74 return value;
76 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
77 public static Int32 GetInt32WithAllBitsSet()
79 Int32 value = 0;
80 unsafe
82 unchecked
84 *((Int32*)&value) = (Int32)0xffffffff;
87 return value;
89 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
90 public static UInt64 GetUInt64WithAllBitsSet()
92 UInt64 value = 0;
93 unsafe
95 unchecked
97 *((UInt64*)&value) = (UInt64)0xffffffffffffffff;
100 return value;
102 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
103 public static Int64 GetInt64WithAllBitsSet()
105 Int64 value = 0;
106 unsafe
108 unchecked
110 *((Int64*)&value) = (Int64)0xffffffffffffffff;
113 return value;
115 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
116 public static Single GetSingleWithAllBitsSet()
118 Single value = 0;
119 unsafe
121 unchecked
123 *((Int32*)&value) = (Int32)0xffffffff;
126 return value;
128 [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
129 public static Double GetDoubleWithAllBitsSet()
131 Double value = 0;
132 unsafe
134 unchecked
136 *((Int64*)&value) = (Int64)0xffffffffffffffff;
139 return value;