Merge pull request #3240 from alexanderkyte/aot_compiler_leaks
[mono.git] / mcs / class / System.Numerics.Vectors / System.Numerics / ConstantHelper.cs
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.
4
5 using System.Runtime.CompilerServices;
6
7 namespace System.Numerics
8 {
9     internal class ConstantHelper
10     {
11         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
12         public static Byte GetByteWithAllBitsSet()
13         {
14             Byte value = 0;
15             unsafe
16             {
17                 unchecked
18                 {
19                     *((Byte*)&value) = (Byte)0xff;
20                 }
21             }
22             return value;
23         }
24         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
25         public static SByte GetSByteWithAllBitsSet()
26         {
27             SByte value = 0;
28             unsafe
29             {
30                 unchecked
31                 {
32                     *((SByte*)&value) = (SByte)0xff;
33                 }
34             }
35             return value;
36         }
37         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
38         public static UInt16 GetUInt16WithAllBitsSet()
39         {
40             UInt16 value = 0;
41             unsafe
42             {
43                 unchecked
44                 {
45                     *((UInt16*)&value) = (UInt16)0xffff;
46                 }
47             }
48             return value;
49         }
50         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
51         public static Int16 GetInt16WithAllBitsSet()
52         {
53             Int16 value = 0;
54             unsafe
55             {
56                 unchecked
57                 {
58                     *((Int16*)&value) = (Int16)0xffff;
59                 }
60             }
61             return value;
62         }
63         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
64         public static UInt32 GetUInt32WithAllBitsSet()
65         {
66             UInt32 value = 0;
67             unsafe
68             {
69                 unchecked
70                 {
71                     *((UInt32*)&value) = (UInt32)0xffffffff;
72                 }
73             }
74             return value;
75         }
76         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
77         public static Int32 GetInt32WithAllBitsSet()
78         {
79             Int32 value = 0;
80             unsafe
81             {
82                 unchecked
83                 {
84                     *((Int32*)&value) = (Int32)0xffffffff;
85                 }
86             }
87             return value;
88         }
89         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
90         public static UInt64 GetUInt64WithAllBitsSet()
91         {
92             UInt64 value = 0;
93             unsafe
94             {
95                 unchecked
96                 {
97                     *((UInt64*)&value) = (UInt64)0xffffffffffffffff;
98                 }
99             }
100             return value;
101         }
102         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
103         public static Int64 GetInt64WithAllBitsSet()
104         {
105             Int64 value = 0;
106             unsafe
107             {
108                 unchecked
109                 {
110                     *((Int64*)&value) = (Int64)0xffffffffffffffff;
111                 }
112             }
113             return value;
114         }
115         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
116         public static Single GetSingleWithAllBitsSet()
117         {
118             Single value = 0;
119             unsafe
120             {
121                 unchecked
122                 {
123                     *((Int32*)&value) = (Int32)0xffffffff;
124                 }
125             }
126             return value;
127         }
128         [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
129         public static Double GetDoubleWithAllBitsSet()
130         {
131             Double value = 0;
132             unsafe
133             {
134                 unchecked
135                 {
136                     *((Int64*)&value) = (Int64)0xffffffffffffffff;
137                 }
138             }
139             return value;
140         }
141     }
142 }