71#ifdef __KERNEL_SSE42__
74 __m128 vec = _mm_set_ss(
x);
75 vec = _mm_round_ss(vec, vec, (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC));
76 return _mm_cvtss_si32(vec);
94 const float qf = (
float)q;
95 x =
madd(qf, -0.78515625f * 4,
x);
96 x =
madd(qf, -0.00024187564849853515625f * 4,
x);
97 x =
madd(qf, -3.7747668102383613586e-08f * 4,
x);
98 x =
madd(qf, -1.2816720341285448015e-12f * 4,
x);
100 const float s =
x *
x;
106 float u = 2.6083159809786593541503e-06f;
107 u =
madd(u, s, -0.0001981069071916863322258f);
108 u =
madd(u, s, +0.00833307858556509017944336f);
109 u =
madd(u, s, -0.166666597127914428710938f);
114 u =
clamp(u, -1.0f, 1.0f);
122 const float qf = (
float)q;
123 x =
madd(qf, -0.78515625f * 4,
x);
124 x =
madd(qf, -0.00024187564849853515625f * 4,
x);
125 x =
madd(qf, -3.7747668102383613586e-08f * 4,
x);
126 x =
madd(qf, -1.2816720341285448015e-12f * 4,
x);
128 const float s =
x *
x;
131 float u = -2.71811842367242206819355e-07f;
132 u =
madd(u, s, +2.47990446951007470488548e-05f);
133 u =
madd(u, s, -0.00138888787478208541870117f);
134 u =
madd(u, s, +0.0416666641831398010253906f);
135 u =
madd(u, s, -0.5f);
136 u =
madd(u, s, +1.0f);
140 u =
clamp(u, -1.0f, 1.0f);
148 const float qf = (
float)q;
149 x =
madd(qf, -0.78515625f * 4,
x);
150 x =
madd(qf, -0.00024187564849853515625f * 4,
x);
151 x =
madd(qf, -3.7747668102383613586e-08f * 4,
x);
152 x =
madd(qf, -1.2816720341285448015e-12f * 4,
x);
154 const float s =
x *
x;
159 float su = 2.6083159809786593541503e-06f;
160 su =
madd(su, s, -0.0001981069071916863322258f);
161 su =
madd(su, s, +0.00833307858556509017944336f);
162 su =
madd(su, s, -0.166666597127914428710938f);
164 float cu = -2.71811842367242206819355e-07f;
165 cu =
madd(cu, s, +2.47990446951007470488548e-05f);
166 cu =
madd(cu, s, -0.00138888787478208541870117f);
167 cu =
madd(cu, s, +0.0416666641831398010253906f);
168 cu =
madd(cu, s, -0.5f);
169 cu =
madd(cu, s, +1.0f);
173 su =
clamp(su, -1.0f, 1.0f);
174 cu =
clamp(cu, -1.0f, 1.0f);
191 const float qf = (
float)q;
192 x =
madd(qf, -0.78515625f * 2,
x);
193 x =
madd(qf, -0.00024187564849853515625f * 2,
x);
194 x =
madd(qf, -3.7747668102383613586e-08f * 2,
x);
195 x =
madd(qf, -1.2816720341285448015e-12f * 2,
x);
200 const float s =
x *
x;
201 float u = 0.00927245803177356719970703f;
202 u =
madd(u, s, 0.00331984995864331722259521f);
203 u =
madd(u, s, 0.0242998078465461730957031f);
204 u =
madd(u, s, 0.0534495301544666290283203f);
205 u =
madd(u, s, 0.133383005857467651367188f);
206 u =
madd(u, s, 0.333331853151321411132812f);
221 const float z =
x - ((
x + 25165824.0f) - 25165824.0f);
223 const float Q = 3.10396624f;
224 const float P = 3.584135056f;
263 const float m = (f < 1.0f) ? 1.0f - (1.0f - f) : 1.0f;
271 const float a =
sqrtf(1.0f - m) *
272 (1.5707963267f + m * (-0.213300989f + m * (0.077980478f + m * -0.02164095f)));
283 const float m = (f < 1.0f) ? 1.0f - (1.0f - f) : 1.0f;
285 sqrtf(1.0f - m) * (1.5707963267f +
286 m * (-0.213300989f + m * (0.077980478f + m * -0.02164095f)));
293 const float k = a > 1.0f ? 1 / a : a;
294 const float s = 1.0f - (1.0f - k);
295 const float t = s * s;
302 float r = s *
madd(0.43157974f, t, 1.0f) /
madd(
madd(0.05831938f, t, 0.76443945f), t, 1.0f);
321 const float k = (
b == 0) ? 0.0f : ((a ==
b) ? 1.0f : (
b > a ? a /
b :
b / a));
322 const float s = 1.0f - (1.0f - k);
323 const float t = s * s;
325 float r = s *
madd(0.43157974f, t, 1.0f) /
madd(
madd(0.05831938f, t, 0.76443945f), t, 1.0f);
360 const float f =
__uint_as_float((bits & 0x007FFFFF) | 0x3f800000) - 1.0f;
368 const float f2 = f * f;
369 const float f4 = f2 * f2;
370 float hi =
madd(f, -0.00931049621349f, 0.05206469089414f);
371 float lo =
madd(f, 0.47868480909345f, -0.72116591947498f);
372 hi =
madd(f, hi, -0.13753123777116f);
373 hi =
madd(f, hi, 0.24187369696082f);
374 hi =
madd(f, hi, -0.34730547155299f);
375 lo =
madd(f, lo, 1.442689881667200f);
376 return ((f4 * hi) + (f * lo)) + exponent;
401 return (
float)((int)(bits >> 23) - 127);
409 const int m = (int)
x;
411 x = 1.0f - (1.0f -
x);
420 float r = 1.33336498402e-3f;
421 r =
madd(
x, r, 9.810352697968e-3f);
422 r =
madd(
x, r, 5.551834031939e-2f);
423 r =
madd(
x, r, 0.2401793301105f);
424 r =
madd(
x, r, 0.693144857883f);
425 r =
madd(
x, r, 1.0f);
439#if !defined(__KERNEL_GPU__) && !defined(_MSC_VER)
481 x = 1.0f - (1.0f -
x);
496 a = 1.0f - (1.0f - a);
497 const float a2 = a * a;
500 float r = 2.03945513931e-4f;
501 r =
madd(r, a2, 8.32990277558e-3f);
502 r =
madd(r, a2, 0.1666673421859f);
503 r =
madd(r * a, a2, a);
513 return 0.5f *
e + 0.5f /
e;
540 if (ybits >= 0x4b800000) {
543 else if (ybits >= 0x3f800000) {
545 const int k = (ybits >> 23) - 127;
546 const int j = ybits >> (23 - k);
547 if ((j << (23 - k)) == ybits) {
572 const float a1 = 0.0705230784f;
573 const float a2 = 0.0422820123f;
574 const float a3 = 0.0092705272f;
575 const float a4 = 0.0001520143f;
576 const float a5 = 0.0002765672f;
577 const float a6 = 0.0000430638f;
582 const float b = 1.0f - (1.0f - a);
583 const float r =
madd(
584 madd(
madd(
madd(
madd(
madd(a6,
b, a5),
b, a4),
b, a3),
b, a2),
b, a1),
b, 1.0f);
585 const float s = r * r;
586 const float t = s * s;
587 const float u = t * t;
588 const float v = u * u;
607 const float a =
min(
fabsf(
x), 0.99999994f);
608 float w = -
fast_logf((1.0f - a) * (1.0f + a));
613 p =
madd(p,
w, 3.43273939e-07f);
614 p =
madd(p,
w, -3.5233877e-06f);
615 p =
madd(p,
w, -4.39150654e-06f);
616 p =
madd(p,
w, 0.00021858087f);
617 p =
madd(p,
w, -0.00125372503f);
618 p =
madd(p,
w, -0.00417768164f);
619 p =
madd(p,
w, 0.246640727f);
620 p =
madd(p,
w, 1.50140941f);
624 p = -0.000200214257f;
625 p =
madd(p,
w, 0.000100950558f);
626 p =
madd(p,
w, 0.00134934322f);
627 p =
madd(p,
w, -0.00367342844f);
628 p =
madd(p,
w, 0.00573950773f);
629 p =
madd(p,
w, -0.0076224613f);
630 p =
madd(p,
w, 0.00943887047f);
631 p =
madd(p,
w, 1.00167406f);
632 p =
madd(p,
w, 2.83297682f);
645 y = (2.0f / 3) *
y + 1 / (3 *
y *
y *
x);
646 y = (2.0f / 3) *
y + 1 / (3 *
y *
y *
x);
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
#define util_assert(statement)
#define ccl_device_inline
#define CCL_NAMESPACE_END
constexpr T clamp(T, U, U) RET
ccl_device_inline int float_to_int(const float f)
ccl_device float fast_exp2f(float x)
ccl_device float fast_atan2f(const float y, const float x)
ccl_device float fast_acosf(const float x)
ccl_device_inline float fast_exp10(const float x)
CCL_NAMESPACE_BEGIN ccl_device_inline float madd(const float a, const float b, const float c)
ccl_device_inline float4 madd4(const float4 a, const float4 b, const float4 c)
ccl_device void fast_sincosf(float x, ccl_private float *sine, ccl_private float *cosine)
ccl_device float4 fast_exp2f4(float4 x)
ccl_device float fast_asinf(const float x)
ccl_device float fast_sinpif(const float x)
ccl_device_inline float fast_log10(const float x)
ccl_device_inline int fast_rint(const float x)
ccl_device_inline float fast_erfcf(const float x)
ccl_device_inline float fast_erff(const float x)
ccl_device float fast_logb(float x)
ccl_device float fast_tanf(float x)
ccl_device_inline float fast_expf(const float x)
ccl_device_inline float fast_coshf(const float x)
ccl_device float fast_sinhf(const float x)
ccl_device_inline float fast_cospif(const float x)
ccl_device_inline float fast_tanhf(const float x)
ccl_device_inline float fast_expm1f(float x)
ccl_device float fast_safe_powf(const float x, const float y)
ccl_device_inline int floor_log2f(const float x)
ccl_device float fast_atanf(const float x)
ccl_device_inline float vector_angle(const float3 a, const float3 b)
ccl_device float fast_sinf(float x)
ccl_device float fast_cosf(float x)
ccl_device_inline float fast_inv_cbrtf(const float x)
ccl_device float fast_log2f(float x)
ccl_device_inline float fast_logf(const float x)
ccl_device_inline float4 fast_expf4(const float4 x)
ccl_device_inline float fast_ierff(const float x)
ccl_device_inline int4 __float4_as_int4(const float4 f)
ccl_device_inline float4 __int4_as_float4(const int4 i)