6 #ifndef _EULE_NO_INTRINSICS_
24 #ifndef _EULE_NO_INTRINSICS_
27 __m256 __vector_self = _mm256_set_ps(0,0,0,0,0,0, (
float)y, (
float)x);
28 __m256 __vector_other = _mm256_set_ps(0,0,0,0,0,0, (
float)other.
y, (
float)other.
x);
31 const int mask = 0x31;
32 __m256 __dot = _mm256_dp_ps(__vector_self, __vector_other, mask);
36 _mm256_storeu_ps(result, __dot);
41 return (x * other.
x) +
49 int iDot = (x * other.
x) +
60 return (x * other.
y) -
67 int iCross = (x * other.
y) -
70 return (
double)iCross;
79 return DotProduct(*
this);
85 int iSqrMag = x*x + y*y;
86 return (
double)iSqrMag;
92 return sqrt(SqrMagnitude());
99 #ifndef _EULE_NO_INTRINSICS_
102 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
103 __m256d __vector_scalar = _mm256_set_pd(0, 0, scalar.
y, scalar.
x);
106 __m256d __product = _mm256_mul_pd(__vector_self, __vector_scalar);
110 _mm256_storeu_pd(result, __product);
148 double length = Magnitude();
158 #ifndef _EULE_NO_INTRINSICS_
161 __m256d __vec = _mm256_set_pd(0, 0, y, x);
162 __m256d __len = _mm256_set1_pd(length);
165 __m256d __prod = _mm256_div_pd(__vec, __len);
169 _mm256_storeu_pd(prod, __prod);
189 std::cerr <<
"Stop normalizing int-vectors!!" << std::endl;
200 const double it = 1.0 - t;
202 #ifndef _EULE_NO_INTRINSICS_
205 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
206 __m256d __vector_other = _mm256_set_pd(0, 0, other.
y, other.
x);
207 __m256d __t = _mm256_set1_pd(t);
208 __m256d __it = _mm256_set1_pd(it);
213 __m256d __sum = _mm256_set1_pd(0);
215 __sum = _mm256_fmadd_pd(__vector_self, __it, __sum);
216 __sum = _mm256_fmadd_pd(__vector_other, __t, __sum);
220 _mm256_storeu_pd(sum, __sum);
227 x = it * x + t * other.
x;
228 y = it * y + t * other.
y;
240 const double it = 1.0 - t;
242 x = (int)(it * (
double)x + t * (double)other.
x);
243 y = (int)(it * (
double)y + t * (double)other.
y);
251 copy.LerpSelf(other, t);
276 throw std::out_of_range(
"Array descriptor on Vector2<T> out of range!");
290 throw std::out_of_range(
"Array descriptor on Vector2<T> out of range!");
298 (::Math::Similar(x, other.
x, epsilon)) &&
299 (::Math::Similar(y, other.
y, epsilon))
318 #ifndef _EULE_NO_INTRINSICS_
321 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
322 __m256d __vector_other = _mm256_set_pd(0, 0, other.
y, other.
x);
325 __m256d __sum = _mm256_add_pd(__vector_self, __vector_other);
329 _mm256_storeu_pd(sum, __sum);
358 #ifndef _EULE_NO_INTRINSICS_
361 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
362 __m256d __vector_other = _mm256_set_pd(0, 0, other.
y, other.
x);
365 __m256d __sum = _mm256_add_pd(__vector_self, __vector_other);
369 _mm256_storeu_pd(sum, __sum);
396 #ifndef _EULE_NO_INTRINSICS_
399 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
400 __m256d __vector_other = _mm256_set_pd(0, 0, other.
y, other.
x);
403 __m256d __diff = _mm256_sub_pd(__vector_self, __vector_other);
407 _mm256_storeu_pd(diff, __diff);
436 #ifndef _EULE_NO_INTRINSICS_
439 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
440 __m256d __vector_other = _mm256_set_pd(0, 0, other.
y, other.
x);
443 __m256d __diff = _mm256_sub_pd(__vector_self, __vector_other);
447 _mm256_storeu_pd(diff, __diff);
474 #ifndef _EULE_NO_INTRINSICS_
477 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
478 __m256d __scalar = _mm256_set1_pd(scale);
481 __m256d __prod = _mm256_mul_pd(__vector_self, __scalar);
485 _mm256_storeu_pd(prod, __prod);
515 #ifndef _EULE_NO_INTRINSICS_
518 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
519 __m256d __scalar = _mm256_set1_pd(scale);
522 __m256d __prod = _mm256_mul_pd(__vector_self, __scalar);
526 _mm256_storeu_pd(prod, __prod);
553 #ifndef _EULE_NO_INTRINSICS_
556 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
557 __m256d __scalar = _mm256_set1_pd(scale);
560 __m256d __prod = _mm256_div_pd(__vector_self, __scalar);
564 _mm256_storeu_pd(prod, __prod);
594 #ifndef _EULE_NO_INTRINSICS_
597 __m256d __vector_self = _mm256_set_pd(0, 0, y, x);
598 __m256d __scalar = _mm256_set1_pd(scale);
601 __m256d __prod = _mm256_div_pd(__vector_self, __scalar);
605 _mm256_storeu_pd(prod, __prod);
641 x = std::move(other.
x);
642 y = std::move(other.
y);
658 return !operator==(other);
689 template <
typename T>
691 template <
typename T>
693 template <
typename T>
695 template <
typename T>
697 template <
typename T>
699 template <
typename T>