[simd] Mark Mono.Simd classes as obsolete.
[mono.git] / mcs / class / Mono.Simd / Mono.Simd / Vector2l.cs
1 // Vector2l.cs
2 //
3 // Author:
4 //   Rodrigo Kumpera (rkumpera@novell.com)
5 //
6 // (C) 2008 Novell, Inc. (http://www.novell.com)
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 //
27 using System;
28 using System.Runtime.InteropServices;
29
30 namespace Mono.Simd
31 {
32         [Obsolete ("Use the types in the System.Numerics.Vectors namespace")]
33         [StructLayout(LayoutKind.Explicit, Pack = 0, Size = 16)]
34         public struct Vector2l
35         {
36                 [ FieldOffset(0) ]
37                 internal long x;
38                 [ FieldOffset(8) ]
39                 internal long y;
40
41                 public long X { get { return x; } set { x = value; } }
42                 public long Y { get { return y; } set { y = value; } }
43
44                 public static Vector2l One
45                 {
46                         get { return new Vector2l (1); }
47                 }
48
49                 public static Vector2l Zero
50                 {
51                         get { return new Vector2l (0); }
52                 }
53
54                 public static Vector2l MinusOne
55                 {
56                         get { return new Vector2l (-1); }
57                 }
58
59                 [System.Runtime.CompilerServices.IndexerName ("Component")]
60                 public unsafe long this [int index]
61                 {
62                         get {
63                                 if ((index | 0x1) != 0x1) //index < 0 || index > 1
64                                         throw new ArgumentOutOfRangeException ("index");
65                                 fixed (long *v = &x) {
66                                         return * (v + index);
67                                 }
68                         }
69                         set {
70                                 if ( (index | 0x1) != 0x1) //index < 0 || index > 1
71                                         throw new ArgumentOutOfRangeException ("index");
72                                 fixed (long *v = &x) {
73                                         * (v + index) = value;
74                                 }
75                         }
76                 }
77
78                 public Vector2l (long x, long y)
79                 {
80                         this.x = x;
81                         this.y = y;
82                 }
83
84                 public Vector2l (long l)
85                 {
86                         this.x = l;
87                         this.y = l;
88                 }
89
90                 [Acceleration (AccelMode.SSE2)]
91                 public static Vector2l operator + (Vector2l v1, Vector2l v2)
92                 {
93                         return new Vector2l (v1.x + v2.x, v1.y + v2.y);
94                 }
95
96                 [Acceleration (AccelMode.SSE2)]
97                 public static Vector2l operator - (Vector2l v1, Vector2l v2)
98                 {
99                         return new Vector2l (v1.x - v2.x, v1.y - v2.y);
100                 }
101
102                 [Acceleration (AccelMode.SSE2)]
103                 public static unsafe Vector2l operator << (Vector2l v1, int amount)
104                 {
105                         return new Vector2l (v1.x << amount, v1.y << amount);
106                 }
107
108                 [Acceleration (AccelMode.SSE2)]
109                 public static Vector2l operator & (Vector2l v1, Vector2l v2)
110                 {
111                         return new Vector2l (v1.x & v2.x, v1.y & v2.y);
112                 }
113
114                 [Acceleration (AccelMode.SSE2)]
115                 public static Vector2l operator | (Vector2l v1, Vector2l v2)
116                 {
117                         return new Vector2l (v1.x | v2.x, v1.y | v2.y);
118                 }
119
120                 [Acceleration (AccelMode.SSE2)]
121                 public static Vector2l operator ^ (Vector2l v1, Vector2l v2)
122                 {
123                         return new Vector2l (v1.x ^ v2.x, v1.y ^ v2.y);
124                 }
125
126                 [Acceleration (AccelMode.SSE1)]
127                 public static unsafe explicit operator Vector2d (Vector2l v)
128                 {
129                         Vector2d* p = (Vector2d*)&v;
130                         return *p;
131                 }
132
133                 [Acceleration (AccelMode.SSE1)]
134                 public static unsafe explicit operator Vector4f (Vector2l v)
135                 {
136                         Vector4f* p = (Vector4f*)&v;
137                         return *p;
138                 }
139
140                 [Acceleration (AccelMode.SSE1)]
141                 [CLSCompliant(false)]
142                 public static unsafe explicit operator Vector2ul (Vector2l v)
143                 {
144                         Vector2ul* p = (Vector2ul*)&v;
145                         return *p;
146                 }
147
148                 [Acceleration (AccelMode.SSE1)]
149                 public static unsafe explicit operator Vector4i (Vector2l v)
150                 {
151                         Vector4i* p = (Vector4i*)&v;
152                         return *p;
153                 }
154
155                 [Acceleration (AccelMode.SSE1)]
156                 [CLSCompliant(false)]
157                 public static unsafe explicit operator Vector4ui (Vector2l v)
158                 {
159                         Vector4ui* p = (Vector4ui*)&v;
160                         return *p;
161                 }
162
163                 [Acceleration (AccelMode.SSE1)]
164                 public static unsafe explicit operator Vector8s (Vector2l v)
165                 {
166                         Vector8s* p = (Vector8s*)&v;
167                         return *p;
168                 }
169
170                 [Acceleration (AccelMode.SSE1)]
171                 [CLSCompliant(false)]
172                 public static unsafe explicit operator Vector8us (Vector2l v)
173                 {
174                         Vector8us* p = (Vector8us*)&v;
175                         return *p;
176                 }
177
178                 [Acceleration (AccelMode.SSE1)]
179                 [CLSCompliant(false)]
180                 public static unsafe explicit operator Vector16sb (Vector2l v)
181                 {
182                         Vector16sb* p = (Vector16sb*)&v;
183                         return *p;
184                 }
185
186                 [Acceleration (AccelMode.SSE1)]
187                 public static unsafe explicit operator Vector16b (Vector2l v)
188                 {
189                         Vector16b* p = (Vector16b*)&v;
190                         return *p;
191                 }
192
193                 [Acceleration (AccelMode.SSE1)]
194                 public static Vector2l LoadAligned (ref Vector2l v)
195                 {
196                         return v;
197                 }
198
199                 [Acceleration (AccelMode.SSE1)]
200                 public static void StoreAligned (ref Vector2l res, Vector2l val)
201                 {
202                         res = val;
203                 }
204
205                 [CLSCompliant(false)]
206                 [Acceleration (AccelMode.SSE1)]
207                 public static unsafe Vector2l LoadAligned (Vector2l *v)
208                 {
209                         return *v;
210                 }
211
212                 [CLSCompliant(false)]
213                 [Acceleration (AccelMode.SSE1)]
214                 public static unsafe void StoreAligned (Vector2l *res, Vector2l val)
215                 {
216                         *res = val;
217                 }
218
219                 [Acceleration (AccelMode.SSE1)]
220                 [CLSCompliant(false)]
221                 public static void PrefetchTemporalAllCacheLevels (ref Vector2l res)
222                 {
223                 }
224
225                 [Acceleration (AccelMode.SSE1)]
226                 [CLSCompliant(false)]
227                 public static void PrefetchTemporal1stLevelCache (ref Vector2l res)
228                 {
229                 }
230
231                 [Acceleration (AccelMode.SSE1)]
232                 [CLSCompliant(false)]
233                 public static void PrefetchTemporal2ndLevelCache (ref Vector2l res)
234                 {
235                 }
236
237                 [Acceleration (AccelMode.SSE1)]
238                 [CLSCompliant(false)]
239                 public static void PrefetchNonTemporal (ref Vector2l res)
240                 {
241                 }
242
243                 [Acceleration (AccelMode.SSE1)]
244                 [CLSCompliant(false)]
245                 public static unsafe void PrefetchTemporalAllCacheLevels (Vector2l *res)
246                 {
247                 }
248
249                 [Acceleration (AccelMode.SSE1)]
250                 [CLSCompliant(false)]
251                 public static unsafe void PrefetchTemporal1stLevelCache (Vector2l *res)
252                 {
253                 }
254
255                 [Acceleration (AccelMode.SSE1)]
256                 [CLSCompliant(false)]
257                 public static unsafe void PrefetchTemporal2ndLevelCache (Vector2l *res)
258                 {
259                 }
260
261                 [Acceleration (AccelMode.SSE1)]
262                 [CLSCompliant(false)]
263                 public static unsafe void PrefetchNonTemporal (Vector2l *res)
264                 {
265                 }
266                 
267                 public override string ToString()
268                 {
269                         return "<" + x + ", " + y + ">"; 
270                 }
271         }
272 }