4 // Rodrigo Kumpera (rkumpera@novell.com)
6 // (C) 2008 Novell, Inc. (http://www.novell.com)
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:
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
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.
28 using System.Runtime.InteropServices;
\r
32 [StructLayout(LayoutKind.Sequential, Pack = 0, Size = 16)]
33 [CLSCompliant(false)]
\r
34 public struct Vector4ui
\r
41 public uint X { get { return x; } set { x = value; } }
\r
42 public uint Y { get { return y; } set { y = value; } }
\r
43 public uint Z { get { return z; } set { z = value; } }
\r
44 public uint W { get { return w; } set { w = value; } }
\r
46 public Vector4ui (uint x, uint y, uint z, uint w)
\r
54 public static Vector4ui operator + (Vector4ui v1, Vector4ui v2)
\r
56 return new Vector4ui (v1.x + v2.x, v1.y + v2.y, v1.z + v2.z, v1.w + v2.w);
\r
59 public static Vector4ui operator - (Vector4ui v1, Vector4ui v2)
\r
61 return new Vector4ui (v1.x - v2.x, v1.y - v2.y, v1.z - v2.z, v1.w - v2.w);
\r
67 public static Vector4ui operator * (Vector4ui v1, Vector4ui v2)
\r
69 return new Vector4ui (v1.x * v2.x, v1.y * v2.y, v1.z * v2.z, v1.w * v2.w);
\r
72 public static unsafe Vector4ui operator << (Vector4ui v1, int amount)
\r
74 return new Vector4ui (v1.x << amount, v1.y << amount, v1.z << amount, v1.w << amount);
\r
77 public static unsafe Vector4ui operator >> (Vector4ui v1, int amount)
\r
79 return new Vector4ui (v1.x >> amount, v1.y >> amount, v1.z >> amount, v1.w >> amount);
\r
83 public static Vector4ui operator & (Vector4ui v1, Vector4ui v2)
\r
85 return new Vector4ui (v1.x & v2.x, v1.y & v2.y, v1.z & v2.z, v1.w & v2.w);
\r
88 public static Vector4ui operator | (Vector4ui v1, Vector4ui v2)
\r
90 return new Vector4ui (v1.x | v2.x, v1.y | v2.y, v1.z | v2.z, v1.w | v2.w);
\r
93 public static Vector4ui operator ^ (Vector4ui v1, Vector4ui v2)
\r
95 return new Vector4ui (v1.x ^ v2.x, v1.y ^ v2.y, v1.z ^ v2.z, v1.w ^ v2.w);
\r
98 public static unsafe Vector4ui UnpackLow (Vector4ui v1, Vector4ui v2)
100 return new Vector4ui (v1.x, v2.x, v1.y, v2.y);
103 public static unsafe Vector4ui UnpackHigh (Vector4ui v1, Vector4ui v2)
105 return new Vector4ui (v1.z, v2.z, v1.w, v2.w);
108 public static unsafe Vector4ui ShiftRightArithmetic (Vector4ui v1, int amount)
\r
110 Vector4ui res = new Vector4ui ();
113 for (int i = 0; i < 4; ++i)
114 *b++ = (uint)((int)(*a++) >> amount);
118 public static unsafe explicit operator Vector4f (Vector4ui v1)
\r
120 Vector4f* p = (Vector4f*)&v1;
\r
124 public static Vector4ui LoadAligned (ref Vector4ui v)
\r
129 public static void StoreAligned (ref Vector4ui res, Vector4ui val)
\r