Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Extras / vectormathlibrary / include / vectormath / spu / c / vec_soa_v.h
1 /*
2    Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
3    All rights reserved.
4
5    Redistribution and use in source and binary forms,
6    with or without modification, are permitted provided that the
7    following conditions are met:
8     * Redistributions of source code must retain the above copyright
9       notice, this list of conditions and the following disclaimer.
10     * Redistributions in binary form must reproduce the above copyright
11       notice, this list of conditions and the following disclaimer in the
12       documentation and/or other materials provided with the distribution.
13     * Neither the name of the Sony Computer Entertainment Inc nor the names
14       of its contributors may be used to endorse or promote products derived
15       from this software without specific prior written permission.
16
17    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27    POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #ifndef _VECTORMATH_VEC_SOA_V_C_H
31 #define _VECTORMATH_VEC_SOA_V_C_H
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35
36 /*-----------------------------------------------------------------------------
37  * Constants
38  * for shuffles, words are labeled [x,y,z,w] [a,b,c,d]
39  */
40 #define _VECTORMATH_SHUF_X 0x00010203
41 #define _VECTORMATH_SHUF_Y 0x04050607
42 #define _VECTORMATH_SHUF_Z 0x08090a0b
43 #define _VECTORMATH_SHUF_W 0x0c0d0e0f
44 #define _VECTORMATH_SHUF_A 0x10111213
45 #define _VECTORMATH_SHUF_B 0x14151617
46 #define _VECTORMATH_SHUF_C 0x18191a1b
47 #define _VECTORMATH_SHUF_D 0x1c1d1e1f
48 #define _VECTORMATH_SHUF_0 0x80808080
49 #define _VECTORMATH_SHUF_XAYB ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_X, _VECTORMATH_SHUF_A, _VECTORMATH_SHUF_Y, _VECTORMATH_SHUF_B })
50 #define _VECTORMATH_SHUF_ZCWD ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_Z, _VECTORMATH_SHUF_C, _VECTORMATH_SHUF_W, _VECTORMATH_SHUF_D })
51 #define _VECTORMATH_SHUF_ZBW0 ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_Z, _VECTORMATH_SHUF_B, _VECTORMATH_SHUF_W, _VECTORMATH_SHUF_0 })
52 #define _VECTORMATH_SHUF_XCY0 ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_X, _VECTORMATH_SHUF_C, _VECTORMATH_SHUF_Y, _VECTORMATH_SHUF_0 })
53 #define _VECTORMATH_SHUF_ZDW0 ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_Z, _VECTORMATH_SHUF_D, _VECTORMATH_SHUF_W, _VECTORMATH_SHUF_0 })
54 #define _VECTORMATH_SHUF_XAZC ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_X, _VECTORMATH_SHUF_A, _VECTORMATH_SHUF_Z, _VECTORMATH_SHUF_C })
55 #define _VECTORMATH_SHUF_ZDXB ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_Z, _VECTORMATH_SHUF_D, _VECTORMATH_SHUF_X, _VECTORMATH_SHUF_B })
56 #define _VECTORMATH_SHUF_YBWD ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_Y, _VECTORMATH_SHUF_B, _VECTORMATH_SHUF_W, _VECTORMATH_SHUF_D })
57 #define _VECTORMATH_SHUF_XDZB ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_X, _VECTORMATH_SHUF_D, _VECTORMATH_SHUF_Z, _VECTORMATH_SHUF_B })
58 #define _VECTORMATH_SHUF_YAWC ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_Y, _VECTORMATH_SHUF_A, _VECTORMATH_SHUF_W, _VECTORMATH_SHUF_C })
59 #define _VECTORMATH_SHUF_ZBXD ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_Z, _VECTORMATH_SHUF_B, _VECTORMATH_SHUF_X, _VECTORMATH_SHUF_D })
60 #define _VECTORMATH_SHUF_XYCD ((vec_uchar16)(vec_uint4){ _VECTORMATH_SHUF_X, _VECTORMATH_SHUF_Y, _VECTORMATH_SHUF_C, _VECTORMATH_SHUF_D })
61 #define _VECTORMATH_SLERP_TOL 0.999f
62
63 /*-----------------------------------------------------------------------------
64  * Definitions
65  */
66 #ifndef _VECTORMATH_INTERNAL_FUNCTIONS
67 #define _VECTORMATH_INTERNAL_FUNCTIONS
68
69 #endif
70
71 static inline VmathSoaVector3 vmathSoaV3MakeFromElems_V( vec_float4 _x, vec_float4 _y, vec_float4 _z )
72 {
73     VmathSoaVector3 result;
74     vmathSoaV3MakeFromElems(&result, _x, _y, _z);
75     return result;
76 }
77
78 static inline VmathSoaVector3 vmathSoaV3MakeFromP3_V( VmathSoaPoint3 pnt )
79 {
80     VmathSoaVector3 result;
81     vmathSoaV3MakeFromP3(&result, &pnt);
82     return result;
83 }
84
85 static inline VmathSoaVector3 vmathSoaV3MakeFromScalar_V( vec_float4 scalar )
86 {
87     VmathSoaVector3 result;
88     vmathSoaV3MakeFromScalar(&result, scalar);
89     return result;
90 }
91
92 static inline VmathSoaVector3 vmathSoaV3MakeFromAos_V( VmathVector3 vec )
93 {
94     VmathSoaVector3 result;
95     vmathSoaV3MakeFromAos(&result, &vec);
96     return result;
97 }
98
99 static inline VmathSoaVector3 vmathSoaV3MakeFrom4Aos_V( VmathVector3 vec0, VmathVector3 vec1, VmathVector3 vec2, VmathVector3 vec3 )
100 {
101     VmathSoaVector3 result;
102     vmathSoaV3MakeFrom4Aos(&result, &vec0, &vec1, &vec2, &vec3);
103     return result;
104 }
105
106 static inline VmathSoaVector3 vmathSoaV3MakeXAxis_V( )
107 {
108     VmathSoaVector3 result;
109     vmathSoaV3MakeXAxis(&result);
110     return result;
111 }
112
113 static inline VmathSoaVector3 vmathSoaV3MakeYAxis_V( )
114 {
115     VmathSoaVector3 result;
116     vmathSoaV3MakeYAxis(&result);
117     return result;
118 }
119
120 static inline VmathSoaVector3 vmathSoaV3MakeZAxis_V( )
121 {
122     VmathSoaVector3 result;
123     vmathSoaV3MakeZAxis(&result);
124     return result;
125 }
126
127 static inline VmathSoaVector3 vmathSoaV3Lerp_V( vec_float4 t, VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
128 {
129     VmathSoaVector3 result;
130     vmathSoaV3Lerp(&result, t, &vec0, &vec1);
131     return result;
132 }
133
134 static inline VmathSoaVector3 vmathSoaV3Slerp_V( vec_float4 t, VmathSoaVector3 unitVec0, VmathSoaVector3 unitVec1 )
135 {
136     VmathSoaVector3 result;
137     vmathSoaV3Slerp(&result, t, &unitVec0, &unitVec1);
138     return result;
139 }
140
141 static inline void vmathSoaV3Get4Aos_V( VmathSoaVector3 vec, VmathVector3 *result0, VmathVector3 *result1, VmathVector3 *result2, VmathVector3 *result3 )
142 {
143     vmathSoaV3Get4Aos(&vec, result0, result1, result2, result3);
144 }
145
146 static inline void vmathSoaV3LoadXYZArray_V( VmathSoaVector3 *vec, const vec_float4 *threeQuads )
147 {
148     vmathSoaV3LoadXYZArray(vec, threeQuads);
149 }
150
151 static inline void vmathSoaV3StoreXYZArray_V( VmathSoaVector3 vec, vec_float4 *threeQuads )
152 {
153     vmathSoaV3StoreXYZArray(&vec, threeQuads);
154 }
155
156 static inline void vmathSoaV3StoreHalfFloats_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1, vec_ushort8 *threeQuads )
157 {
158     vmathSoaV3StoreHalfFloats(&vec0, &vec1, threeQuads);
159 }
160
161 static inline void vmathSoaV3SetX_V( VmathSoaVector3 *result, vec_float4 _x )
162 {
163     vmathSoaV3SetX(result, _x);
164 }
165
166 static inline vec_float4 vmathSoaV3GetX_V( VmathSoaVector3 vec )
167 {
168     return vmathSoaV3GetX(&vec);
169 }
170
171 static inline void vmathSoaV3SetY_V( VmathSoaVector3 *result, vec_float4 _y )
172 {
173     vmathSoaV3SetY(result, _y);
174 }
175
176 static inline vec_float4 vmathSoaV3GetY_V( VmathSoaVector3 vec )
177 {
178     return vmathSoaV3GetY(&vec);
179 }
180
181 static inline void vmathSoaV3SetZ_V( VmathSoaVector3 *result, vec_float4 _z )
182 {
183     vmathSoaV3SetZ(result, _z);
184 }
185
186 static inline vec_float4 vmathSoaV3GetZ_V( VmathSoaVector3 vec )
187 {
188     return vmathSoaV3GetZ(&vec);
189 }
190
191 static inline void vmathSoaV3SetElem_V( VmathSoaVector3 *result, int idx, vec_float4 value )
192 {
193     vmathSoaV3SetElem(result, idx, value);
194 }
195
196 static inline vec_float4 vmathSoaV3GetElem_V( VmathSoaVector3 vec, int idx )
197 {
198     return vmathSoaV3GetElem(&vec, idx);
199 }
200
201 static inline VmathSoaVector3 vmathSoaV3Add_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
202 {
203     VmathSoaVector3 result;
204     vmathSoaV3Add(&result, &vec0, &vec1);
205     return result;
206 }
207
208 static inline VmathSoaVector3 vmathSoaV3Sub_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
209 {
210     VmathSoaVector3 result;
211     vmathSoaV3Sub(&result, &vec0, &vec1);
212     return result;
213 }
214
215 static inline VmathSoaPoint3 vmathSoaV3AddP3_V( VmathSoaVector3 vec, VmathSoaPoint3 pnt1 )
216 {
217     VmathSoaPoint3 result;
218     vmathSoaV3AddP3(&result, &vec, &pnt1);
219     return result;
220 }
221
222 static inline VmathSoaVector3 vmathSoaV3ScalarMul_V( VmathSoaVector3 vec, vec_float4 scalar )
223 {
224     VmathSoaVector3 result;
225     vmathSoaV3ScalarMul(&result, &vec, scalar);
226     return result;
227 }
228
229 static inline VmathSoaVector3 vmathSoaV3ScalarDiv_V( VmathSoaVector3 vec, vec_float4 scalar )
230 {
231     VmathSoaVector3 result;
232     vmathSoaV3ScalarDiv(&result, &vec, scalar);
233     return result;
234 }
235
236 static inline VmathSoaVector3 vmathSoaV3Neg_V( VmathSoaVector3 vec )
237 {
238     VmathSoaVector3 result;
239     vmathSoaV3Neg(&result, &vec);
240     return result;
241 }
242
243 static inline VmathSoaVector3 vmathSoaV3MulPerElem_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
244 {
245     VmathSoaVector3 result;
246     vmathSoaV3MulPerElem(&result, &vec0, &vec1);
247     return result;
248 }
249
250 static inline VmathSoaVector3 vmathSoaV3DivPerElem_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
251 {
252     VmathSoaVector3 result;
253     vmathSoaV3DivPerElem(&result, &vec0, &vec1);
254     return result;
255 }
256
257 static inline VmathSoaVector3 vmathSoaV3RecipPerElem_V( VmathSoaVector3 vec )
258 {
259     VmathSoaVector3 result;
260     vmathSoaV3RecipPerElem(&result, &vec);
261     return result;
262 }
263
264 static inline VmathSoaVector3 vmathSoaV3SqrtPerElem_V( VmathSoaVector3 vec )
265 {
266     VmathSoaVector3 result;
267     vmathSoaV3SqrtPerElem(&result, &vec);
268     return result;
269 }
270
271 static inline VmathSoaVector3 vmathSoaV3RsqrtPerElem_V( VmathSoaVector3 vec )
272 {
273     VmathSoaVector3 result;
274     vmathSoaV3RsqrtPerElem(&result, &vec);
275     return result;
276 }
277
278 static inline VmathSoaVector3 vmathSoaV3AbsPerElem_V( VmathSoaVector3 vec )
279 {
280     VmathSoaVector3 result;
281     vmathSoaV3AbsPerElem(&result, &vec);
282     return result;
283 }
284
285 static inline VmathSoaVector3 vmathSoaV3CopySignPerElem_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
286 {
287     VmathSoaVector3 result;
288     vmathSoaV3CopySignPerElem(&result, &vec0, &vec1);
289     return result;
290 }
291
292 static inline VmathSoaVector3 vmathSoaV3MaxPerElem_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
293 {
294     VmathSoaVector3 result;
295     vmathSoaV3MaxPerElem(&result, &vec0, &vec1);
296     return result;
297 }
298
299 static inline vec_float4 vmathSoaV3MaxElem_V( VmathSoaVector3 vec )
300 {
301     return vmathSoaV3MaxElem(&vec);
302 }
303
304 static inline VmathSoaVector3 vmathSoaV3MinPerElem_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
305 {
306     VmathSoaVector3 result;
307     vmathSoaV3MinPerElem(&result, &vec0, &vec1);
308     return result;
309 }
310
311 static inline vec_float4 vmathSoaV3MinElem_V( VmathSoaVector3 vec )
312 {
313     return vmathSoaV3MinElem(&vec);
314 }
315
316 static inline vec_float4 vmathSoaV3Sum_V( VmathSoaVector3 vec )
317 {
318     return vmathSoaV3Sum(&vec);
319 }
320
321 static inline vec_float4 vmathSoaV3Dot_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
322 {
323     return vmathSoaV3Dot(&vec0, &vec1);
324 }
325
326 static inline vec_float4 vmathSoaV3LengthSqr_V( VmathSoaVector3 vec )
327 {
328     return vmathSoaV3LengthSqr(&vec);
329 }
330
331 static inline vec_float4 vmathSoaV3Length_V( VmathSoaVector3 vec )
332 {
333     return vmathSoaV3Length(&vec);
334 }
335
336 static inline VmathSoaVector3 vmathSoaV3Normalize_V( VmathSoaVector3 vec )
337 {
338     VmathSoaVector3 result;
339     vmathSoaV3Normalize(&result, &vec);
340     return result;
341 }
342
343 static inline VmathSoaVector3 vmathSoaV3Cross_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1 )
344 {
345     VmathSoaVector3 result;
346     vmathSoaV3Cross(&result, &vec0, &vec1);
347     return result;
348 }
349
350 static inline VmathSoaVector3 vmathSoaV3Select_V( VmathSoaVector3 vec0, VmathSoaVector3 vec1, vec_uint4 select1 )
351 {
352     VmathSoaVector3 result;
353     vmathSoaV3Select(&result, &vec0, &vec1, select1);
354     return result;
355 }
356
357 #ifdef _VECTORMATH_DEBUG
358
359 static inline void vmathSoaV3Print_V( VmathSoaVector3 vec )
360 {
361     vmathSoaV3Print(&vec);
362 }
363
364 static inline void vmathSoaV3Prints_V( VmathSoaVector3 vec, const char *name )
365 {
366     vmathSoaV3Prints(&vec, name);
367 }
368
369 #endif
370
371 static inline VmathSoaVector4 vmathSoaV4MakeFromElems_V( vec_float4 _x, vec_float4 _y, vec_float4 _z, vec_float4 _w )
372 {
373     VmathSoaVector4 result;
374     vmathSoaV4MakeFromElems(&result, _x, _y, _z, _w);
375     return result;
376 }
377
378 static inline VmathSoaVector4 vmathSoaV4MakeFromV3Scalar_V( VmathSoaVector3 xyz, vec_float4 _w )
379 {
380     VmathSoaVector4 result;
381     vmathSoaV4MakeFromV3Scalar(&result, &xyz, _w);
382     return result;
383 }
384
385 static inline VmathSoaVector4 vmathSoaV4MakeFromV3_V( VmathSoaVector3 vec )
386 {
387     VmathSoaVector4 result;
388     vmathSoaV4MakeFromV3(&result, &vec);
389     return result;
390 }
391
392 static inline VmathSoaVector4 vmathSoaV4MakeFromP3_V( VmathSoaPoint3 pnt )
393 {
394     VmathSoaVector4 result;
395     vmathSoaV4MakeFromP3(&result, &pnt);
396     return result;
397 }
398
399 static inline VmathSoaVector4 vmathSoaV4MakeFromQ_V( VmathSoaQuat quat )
400 {
401     VmathSoaVector4 result;
402     vmathSoaV4MakeFromQ(&result, &quat);
403     return result;
404 }
405
406 static inline VmathSoaVector4 vmathSoaV4MakeFromScalar_V( vec_float4 scalar )
407 {
408     VmathSoaVector4 result;
409     vmathSoaV4MakeFromScalar(&result, scalar);
410     return result;
411 }
412
413 static inline VmathSoaVector4 vmathSoaV4MakeFromAos_V( VmathVector4 vec )
414 {
415     VmathSoaVector4 result;
416     vmathSoaV4MakeFromAos(&result, &vec);
417     return result;
418 }
419
420 static inline VmathSoaVector4 vmathSoaV4MakeFrom4Aos_V( VmathVector4 vec0, VmathVector4 vec1, VmathVector4 vec2, VmathVector4 vec3 )
421 {
422     VmathSoaVector4 result;
423     vmathSoaV4MakeFrom4Aos(&result, &vec0, &vec1, &vec2, &vec3);
424     return result;
425 }
426
427 static inline VmathSoaVector4 vmathSoaV4MakeXAxis_V( )
428 {
429     VmathSoaVector4 result;
430     vmathSoaV4MakeXAxis(&result);
431     return result;
432 }
433
434 static inline VmathSoaVector4 vmathSoaV4MakeYAxis_V( )
435 {
436     VmathSoaVector4 result;
437     vmathSoaV4MakeYAxis(&result);
438     return result;
439 }
440
441 static inline VmathSoaVector4 vmathSoaV4MakeZAxis_V( )
442 {
443     VmathSoaVector4 result;
444     vmathSoaV4MakeZAxis(&result);
445     return result;
446 }
447
448 static inline VmathSoaVector4 vmathSoaV4MakeWAxis_V( )
449 {
450     VmathSoaVector4 result;
451     vmathSoaV4MakeWAxis(&result);
452     return result;
453 }
454
455 static inline VmathSoaVector4 vmathSoaV4Lerp_V( vec_float4 t, VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
456 {
457     VmathSoaVector4 result;
458     vmathSoaV4Lerp(&result, t, &vec0, &vec1);
459     return result;
460 }
461
462 static inline VmathSoaVector4 vmathSoaV4Slerp_V( vec_float4 t, VmathSoaVector4 unitVec0, VmathSoaVector4 unitVec1 )
463 {
464     VmathSoaVector4 result;
465     vmathSoaV4Slerp(&result, t, &unitVec0, &unitVec1);
466     return result;
467 }
468
469 static inline void vmathSoaV4Get4Aos_V( VmathSoaVector4 vec, VmathVector4 *result0, VmathVector4 *result1, VmathVector4 *result2, VmathVector4 *result3 )
470 {
471     vmathSoaV4Get4Aos(&vec, result0, result1, result2, result3);
472 }
473
474 static inline void vmathSoaV4StoreHalfFloats_V( VmathSoaVector4 vec, vec_ushort8 *twoQuads )
475 {
476     vmathSoaV4StoreHalfFloats(&vec, twoQuads);
477 }
478
479 static inline void vmathSoaV4SetXYZ_V( VmathSoaVector4 *result, VmathSoaVector3 vec )
480 {
481     vmathSoaV4SetXYZ(result, &vec);
482 }
483
484 static inline VmathSoaVector3 vmathSoaV4GetXYZ_V( VmathSoaVector4 vec )
485 {
486     VmathSoaVector3 result;
487     vmathSoaV4GetXYZ(&result, &vec);
488     return result;
489 }
490
491 static inline void vmathSoaV4SetX_V( VmathSoaVector4 *result, vec_float4 _x )
492 {
493     vmathSoaV4SetX(result, _x);
494 }
495
496 static inline vec_float4 vmathSoaV4GetX_V( VmathSoaVector4 vec )
497 {
498     return vmathSoaV4GetX(&vec);
499 }
500
501 static inline void vmathSoaV4SetY_V( VmathSoaVector4 *result, vec_float4 _y )
502 {
503     vmathSoaV4SetY(result, _y);
504 }
505
506 static inline vec_float4 vmathSoaV4GetY_V( VmathSoaVector4 vec )
507 {
508     return vmathSoaV4GetY(&vec);
509 }
510
511 static inline void vmathSoaV4SetZ_V( VmathSoaVector4 *result, vec_float4 _z )
512 {
513     vmathSoaV4SetZ(result, _z);
514 }
515
516 static inline vec_float4 vmathSoaV4GetZ_V( VmathSoaVector4 vec )
517 {
518     return vmathSoaV4GetZ(&vec);
519 }
520
521 static inline void vmathSoaV4SetW_V( VmathSoaVector4 *result, vec_float4 _w )
522 {
523     vmathSoaV4SetW(result, _w);
524 }
525
526 static inline vec_float4 vmathSoaV4GetW_V( VmathSoaVector4 vec )
527 {
528     return vmathSoaV4GetW(&vec);
529 }
530
531 static inline void vmathSoaV4SetElem_V( VmathSoaVector4 *result, int idx, vec_float4 value )
532 {
533     vmathSoaV4SetElem(result, idx, value);
534 }
535
536 static inline vec_float4 vmathSoaV4GetElem_V( VmathSoaVector4 vec, int idx )
537 {
538     return vmathSoaV4GetElem(&vec, idx);
539 }
540
541 static inline VmathSoaVector4 vmathSoaV4Add_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
542 {
543     VmathSoaVector4 result;
544     vmathSoaV4Add(&result, &vec0, &vec1);
545     return result;
546 }
547
548 static inline VmathSoaVector4 vmathSoaV4Sub_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
549 {
550     VmathSoaVector4 result;
551     vmathSoaV4Sub(&result, &vec0, &vec1);
552     return result;
553 }
554
555 static inline VmathSoaVector4 vmathSoaV4ScalarMul_V( VmathSoaVector4 vec, vec_float4 scalar )
556 {
557     VmathSoaVector4 result;
558     vmathSoaV4ScalarMul(&result, &vec, scalar);
559     return result;
560 }
561
562 static inline VmathSoaVector4 vmathSoaV4ScalarDiv_V( VmathSoaVector4 vec, vec_float4 scalar )
563 {
564     VmathSoaVector4 result;
565     vmathSoaV4ScalarDiv(&result, &vec, scalar);
566     return result;
567 }
568
569 static inline VmathSoaVector4 vmathSoaV4Neg_V( VmathSoaVector4 vec )
570 {
571     VmathSoaVector4 result;
572     vmathSoaV4Neg(&result, &vec);
573     return result;
574 }
575
576 static inline VmathSoaVector4 vmathSoaV4MulPerElem_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
577 {
578     VmathSoaVector4 result;
579     vmathSoaV4MulPerElem(&result, &vec0, &vec1);
580     return result;
581 }
582
583 static inline VmathSoaVector4 vmathSoaV4DivPerElem_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
584 {
585     VmathSoaVector4 result;
586     vmathSoaV4DivPerElem(&result, &vec0, &vec1);
587     return result;
588 }
589
590 static inline VmathSoaVector4 vmathSoaV4RecipPerElem_V( VmathSoaVector4 vec )
591 {
592     VmathSoaVector4 result;
593     vmathSoaV4RecipPerElem(&result, &vec);
594     return result;
595 }
596
597 static inline VmathSoaVector4 vmathSoaV4SqrtPerElem_V( VmathSoaVector4 vec )
598 {
599     VmathSoaVector4 result;
600     vmathSoaV4SqrtPerElem(&result, &vec);
601     return result;
602 }
603
604 static inline VmathSoaVector4 vmathSoaV4RsqrtPerElem_V( VmathSoaVector4 vec )
605 {
606     VmathSoaVector4 result;
607     vmathSoaV4RsqrtPerElem(&result, &vec);
608     return result;
609 }
610
611 static inline VmathSoaVector4 vmathSoaV4AbsPerElem_V( VmathSoaVector4 vec )
612 {
613     VmathSoaVector4 result;
614     vmathSoaV4AbsPerElem(&result, &vec);
615     return result;
616 }
617
618 static inline VmathSoaVector4 vmathSoaV4CopySignPerElem_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
619 {
620     VmathSoaVector4 result;
621     vmathSoaV4CopySignPerElem(&result, &vec0, &vec1);
622     return result;
623 }
624
625 static inline VmathSoaVector4 vmathSoaV4MaxPerElem_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
626 {
627     VmathSoaVector4 result;
628     vmathSoaV4MaxPerElem(&result, &vec0, &vec1);
629     return result;
630 }
631
632 static inline vec_float4 vmathSoaV4MaxElem_V( VmathSoaVector4 vec )
633 {
634     return vmathSoaV4MaxElem(&vec);
635 }
636
637 static inline VmathSoaVector4 vmathSoaV4MinPerElem_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
638 {
639     VmathSoaVector4 result;
640     vmathSoaV4MinPerElem(&result, &vec0, &vec1);
641     return result;
642 }
643
644 static inline vec_float4 vmathSoaV4MinElem_V( VmathSoaVector4 vec )
645 {
646     return vmathSoaV4MinElem(&vec);
647 }
648
649 static inline vec_float4 vmathSoaV4Sum_V( VmathSoaVector4 vec )
650 {
651     return vmathSoaV4Sum(&vec);
652 }
653
654 static inline vec_float4 vmathSoaV4Dot_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1 )
655 {
656     return vmathSoaV4Dot(&vec0, &vec1);
657 }
658
659 static inline vec_float4 vmathSoaV4LengthSqr_V( VmathSoaVector4 vec )
660 {
661     return vmathSoaV4LengthSqr(&vec);
662 }
663
664 static inline vec_float4 vmathSoaV4Length_V( VmathSoaVector4 vec )
665 {
666     return vmathSoaV4Length(&vec);
667 }
668
669 static inline VmathSoaVector4 vmathSoaV4Normalize_V( VmathSoaVector4 vec )
670 {
671     VmathSoaVector4 result;
672     vmathSoaV4Normalize(&result, &vec);
673     return result;
674 }
675
676 static inline VmathSoaVector4 vmathSoaV4Select_V( VmathSoaVector4 vec0, VmathSoaVector4 vec1, vec_uint4 select1 )
677 {
678     VmathSoaVector4 result;
679     vmathSoaV4Select(&result, &vec0, &vec1, select1);
680     return result;
681 }
682
683 #ifdef _VECTORMATH_DEBUG
684
685 static inline void vmathSoaV4Print_V( VmathSoaVector4 vec )
686 {
687     vmathSoaV4Print(&vec);
688 }
689
690 static inline void vmathSoaV4Prints_V( VmathSoaVector4 vec, const char *name )
691 {
692     vmathSoaV4Prints(&vec, name);
693 }
694
695 #endif
696
697 static inline VmathSoaPoint3 vmathSoaP3MakeFromElems_V( vec_float4 _x, vec_float4 _y, vec_float4 _z )
698 {
699     VmathSoaPoint3 result;
700     vmathSoaP3MakeFromElems(&result, _x, _y, _z);
701     return result;
702 }
703
704 static inline VmathSoaPoint3 vmathSoaP3MakeFromV3_V( VmathSoaVector3 vec )
705 {
706     VmathSoaPoint3 result;
707     vmathSoaP3MakeFromV3(&result, &vec);
708     return result;
709 }
710
711 static inline VmathSoaPoint3 vmathSoaP3MakeFromScalar_V( vec_float4 scalar )
712 {
713     VmathSoaPoint3 result;
714     vmathSoaP3MakeFromScalar(&result, scalar);
715     return result;
716 }
717
718 static inline VmathSoaPoint3 vmathSoaP3MakeFromAos_V( VmathPoint3 pnt )
719 {
720     VmathSoaPoint3 result;
721     vmathSoaP3MakeFromAos(&result, &pnt);
722     return result;
723 }
724
725 static inline VmathSoaPoint3 vmathSoaP3MakeFrom4Aos_V( VmathPoint3 pnt0, VmathPoint3 pnt1, VmathPoint3 pnt2, VmathPoint3 pnt3 )
726 {
727     VmathSoaPoint3 result;
728     vmathSoaP3MakeFrom4Aos(&result, &pnt0, &pnt1, &pnt2, &pnt3);
729     return result;
730 }
731
732 static inline VmathSoaPoint3 vmathSoaP3Lerp_V( vec_float4 t, VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
733 {
734     VmathSoaPoint3 result;
735     vmathSoaP3Lerp(&result, t, &pnt0, &pnt1);
736     return result;
737 }
738
739 static inline void vmathSoaP3Get4Aos_V( VmathSoaPoint3 pnt, VmathPoint3 *result0, VmathPoint3 *result1, VmathPoint3 *result2, VmathPoint3 *result3 )
740 {
741     vmathSoaP3Get4Aos(&pnt, result0, result1, result2, result3);
742 }
743
744 static inline void vmathSoaP3LoadXYZArray_V( VmathSoaPoint3 *vec, const vec_float4 *threeQuads )
745 {
746     vmathSoaP3LoadXYZArray(vec, threeQuads);
747 }
748
749 static inline void vmathSoaP3StoreXYZArray_V( VmathSoaPoint3 vec, vec_float4 *threeQuads )
750 {
751     vmathSoaP3StoreXYZArray(&vec, threeQuads);
752 }
753
754 static inline void vmathSoaP3StoreHalfFloats_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1, vec_ushort8 *threeQuads )
755 {
756     vmathSoaP3StoreHalfFloats(&pnt0, &pnt1, threeQuads);
757 }
758
759 static inline void vmathSoaP3SetX_V( VmathSoaPoint3 *result, vec_float4 _x )
760 {
761     vmathSoaP3SetX(result, _x);
762 }
763
764 static inline vec_float4 vmathSoaP3GetX_V( VmathSoaPoint3 pnt )
765 {
766     return vmathSoaP3GetX(&pnt);
767 }
768
769 static inline void vmathSoaP3SetY_V( VmathSoaPoint3 *result, vec_float4 _y )
770 {
771     vmathSoaP3SetY(result, _y);
772 }
773
774 static inline vec_float4 vmathSoaP3GetY_V( VmathSoaPoint3 pnt )
775 {
776     return vmathSoaP3GetY(&pnt);
777 }
778
779 static inline void vmathSoaP3SetZ_V( VmathSoaPoint3 *result, vec_float4 _z )
780 {
781     vmathSoaP3SetZ(result, _z);
782 }
783
784 static inline vec_float4 vmathSoaP3GetZ_V( VmathSoaPoint3 pnt )
785 {
786     return vmathSoaP3GetZ(&pnt);
787 }
788
789 static inline void vmathSoaP3SetElem_V( VmathSoaPoint3 *result, int idx, vec_float4 value )
790 {
791     vmathSoaP3SetElem(result, idx, value);
792 }
793
794 static inline vec_float4 vmathSoaP3GetElem_V( VmathSoaPoint3 pnt, int idx )
795 {
796     return vmathSoaP3GetElem(&pnt, idx);
797 }
798
799 static inline VmathSoaVector3 vmathSoaP3Sub_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
800 {
801     VmathSoaVector3 result;
802     vmathSoaP3Sub(&result, &pnt0, &pnt1);
803     return result;
804 }
805
806 static inline VmathSoaPoint3 vmathSoaP3AddV3_V( VmathSoaPoint3 pnt, VmathSoaVector3 vec1 )
807 {
808     VmathSoaPoint3 result;
809     vmathSoaP3AddV3(&result, &pnt, &vec1);
810     return result;
811 }
812
813 static inline VmathSoaPoint3 vmathSoaP3SubV3_V( VmathSoaPoint3 pnt, VmathSoaVector3 vec1 )
814 {
815     VmathSoaPoint3 result;
816     vmathSoaP3SubV3(&result, &pnt, &vec1);
817     return result;
818 }
819
820 static inline VmathSoaPoint3 vmathSoaP3MulPerElem_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
821 {
822     VmathSoaPoint3 result;
823     vmathSoaP3MulPerElem(&result, &pnt0, &pnt1);
824     return result;
825 }
826
827 static inline VmathSoaPoint3 vmathSoaP3DivPerElem_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
828 {
829     VmathSoaPoint3 result;
830     vmathSoaP3DivPerElem(&result, &pnt0, &pnt1);
831     return result;
832 }
833
834 static inline VmathSoaPoint3 vmathSoaP3RecipPerElem_V( VmathSoaPoint3 pnt )
835 {
836     VmathSoaPoint3 result;
837     vmathSoaP3RecipPerElem(&result, &pnt);
838     return result;
839 }
840
841 static inline VmathSoaPoint3 vmathSoaP3SqrtPerElem_V( VmathSoaPoint3 pnt )
842 {
843     VmathSoaPoint3 result;
844     vmathSoaP3SqrtPerElem(&result, &pnt);
845     return result;
846 }
847
848 static inline VmathSoaPoint3 vmathSoaP3RsqrtPerElem_V( VmathSoaPoint3 pnt )
849 {
850     VmathSoaPoint3 result;
851     vmathSoaP3RsqrtPerElem(&result, &pnt);
852     return result;
853 }
854
855 static inline VmathSoaPoint3 vmathSoaP3AbsPerElem_V( VmathSoaPoint3 pnt )
856 {
857     VmathSoaPoint3 result;
858     vmathSoaP3AbsPerElem(&result, &pnt);
859     return result;
860 }
861
862 static inline VmathSoaPoint3 vmathSoaP3CopySignPerElem_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
863 {
864     VmathSoaPoint3 result;
865     vmathSoaP3CopySignPerElem(&result, &pnt0, &pnt1);
866     return result;
867 }
868
869 static inline VmathSoaPoint3 vmathSoaP3MaxPerElem_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
870 {
871     VmathSoaPoint3 result;
872     vmathSoaP3MaxPerElem(&result, &pnt0, &pnt1);
873     return result;
874 }
875
876 static inline vec_float4 vmathSoaP3MaxElem_V( VmathSoaPoint3 pnt )
877 {
878     return vmathSoaP3MaxElem(&pnt);
879 }
880
881 static inline VmathSoaPoint3 vmathSoaP3MinPerElem_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
882 {
883     VmathSoaPoint3 result;
884     vmathSoaP3MinPerElem(&result, &pnt0, &pnt1);
885     return result;
886 }
887
888 static inline vec_float4 vmathSoaP3MinElem_V( VmathSoaPoint3 pnt )
889 {
890     return vmathSoaP3MinElem(&pnt);
891 }
892
893 static inline vec_float4 vmathSoaP3Sum_V( VmathSoaPoint3 pnt )
894 {
895     return vmathSoaP3Sum(&pnt);
896 }
897
898 static inline VmathSoaPoint3 vmathSoaP3Scale_V( VmathSoaPoint3 pnt, vec_float4 scaleVal )
899 {
900     VmathSoaPoint3 result;
901     vmathSoaP3Scale(&result, &pnt, scaleVal);
902     return result;
903 }
904
905 static inline VmathSoaPoint3 vmathSoaP3NonUniformScale_V( VmathSoaPoint3 pnt, VmathSoaVector3 scaleVec )
906 {
907     VmathSoaPoint3 result;
908     vmathSoaP3NonUniformScale(&result, &pnt, &scaleVec);
909     return result;
910 }
911
912 static inline vec_float4 vmathSoaP3Projection_V( VmathSoaPoint3 pnt, VmathSoaVector3 unitVec )
913 {
914     return vmathSoaP3Projection(&pnt, &unitVec);
915 }
916
917 static inline vec_float4 vmathSoaP3DistSqrFromOrigin_V( VmathSoaPoint3 pnt )
918 {
919     return vmathSoaP3DistSqrFromOrigin(&pnt);
920 }
921
922 static inline vec_float4 vmathSoaP3DistFromOrigin_V( VmathSoaPoint3 pnt )
923 {
924     return vmathSoaP3DistFromOrigin(&pnt);
925 }
926
927 static inline vec_float4 vmathSoaP3DistSqr_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
928 {
929     return vmathSoaP3DistSqr(&pnt0, &pnt1);
930 }
931
932 static inline vec_float4 vmathSoaP3Dist_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1 )
933 {
934     return vmathSoaP3Dist(&pnt0, &pnt1);
935 }
936
937 static inline VmathSoaPoint3 vmathSoaP3Select_V( VmathSoaPoint3 pnt0, VmathSoaPoint3 pnt1, vec_uint4 select1 )
938 {
939     VmathSoaPoint3 result;
940     vmathSoaP3Select(&result, &pnt0, &pnt1, select1);
941     return result;
942 }
943
944 #ifdef _VECTORMATH_DEBUG
945
946 static inline void vmathSoaP3Print_V( VmathSoaPoint3 pnt )
947 {
948     vmathSoaP3Print(&pnt);
949 }
950
951 static inline void vmathSoaP3Prints_V( VmathSoaPoint3 pnt, const char *name )
952 {
953     vmathSoaP3Prints(&pnt, name);
954 }
955
956 #endif
957
958 #ifdef __cplusplus
959 }
960 #endif /* __cplusplus */
961
962 #endif