| 1104 | } |
| 1105 | |
| 1106 | inline vec_float VecInverseSqrt(const vec_float& v) |
| 1107 | { |
| 1108 | #if defined(TERATHON_SSE) |
| 1109 | |
| 1110 | const vec_float three = VecLoadVectorConstant<0x40400000>(); |
| 1111 | const vec_float half = VecLoadVectorConstant<0x3F000000>(); |
| 1112 | |
| 1113 | vec_float f = _mm_rsqrt_ps(v); |
| 1114 | return (_mm_mul_ps(_mm_mul_ps(_mm_sub_ps(three, _mm_mul_ps(v, _mm_mul_ps(f, f))), f), half)); |
| 1115 | |
| 1116 | #elif defined(TERATHON_NEON) |
| 1117 | |
| 1118 | vec_float f = vrsqrteq_f32(v); |
| 1119 | return (vmulq_f32(f, vrsqrtsq_f32(v, vmulq_f32(f, f)))); |
| 1120 | |
| 1121 | #endif |
| 1122 | } |
| 1123 | |
| 1124 | inline vec_float VecInverseSqrtScalar(const vec_float& v) |
| 1125 | { |