Blender  V2.93
math_base_inline.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  *
19  * The Original Code is: some of this file.
20  */
21 
26 #ifndef __MATH_BASE_INLINE_C__
27 #define __MATH_BASE_INLINE_C__
28 
29 #include <float.h>
30 #include <limits.h>
31 #include <stdio.h>
32 #include <stdlib.h>
33 
34 #include "BLI_math_base.h"
35 #include "BLI_simd.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /* copied from BLI_utildefines.h */
42 #ifdef __GNUC__
43 # define UNLIKELY(x) __builtin_expect(!!(x), 0)
44 #else
45 # define UNLIKELY(x) (x)
46 #endif
47 
48 /* powf is really slow for raising to integer powers. */
49 MINLINE float pow2f(float x)
50 {
51  return x * x;
52 }
53 MINLINE float pow3f(float x)
54 {
55  return pow2f(x) * x;
56 }
57 MINLINE float pow4f(float x)
58 {
59  return pow2f(pow2f(x));
60 }
61 MINLINE float pow5f(float x)
62 {
63  return pow4f(x) * x;
64 }
65 MINLINE float pow7f(float x)
66 {
67  return pow2f(pow3f(x)) * x;
68 }
69 
70 MINLINE float sqrt3f(float f)
71 {
72  if (UNLIKELY(f == 0.0f)) {
73  return 0.0f;
74  }
75  else if (UNLIKELY(f < 0.0f)) {
76  return -(float)(exp(log(-f) / 3.0));
77  }
78  else {
79  return (float)(exp(log(f) / 3.0));
80  }
81 }
82 
83 MINLINE double sqrt3d(double d)
84 {
85  if (UNLIKELY(d == 0.0)) {
86  return 0.0;
87  }
88  else if (UNLIKELY(d < 0.0)) {
89  return -exp(log(-d) / 3.0);
90  }
91  else {
92  return exp(log(d) / 3.0);
93  }
94 }
95 
96 MINLINE float sqrtf_signed(float f)
97 {
98  return (f >= 0.0f) ? sqrtf(f) : -sqrtf(-f);
99 }
100 
101 MINLINE float saacos(float fac)
102 {
103  if (UNLIKELY(fac <= -1.0f)) {
104  return (float)M_PI;
105  }
106  else if (UNLIKELY(fac >= 1.0f)) {
107  return 0.0f;
108  }
109  else {
110  return acosf(fac);
111  }
112 }
113 
114 MINLINE float saasin(float fac)
115 {
116  if (UNLIKELY(fac <= -1.0f)) {
117  return (float)-M_PI / 2.0f;
118  }
119  else if (UNLIKELY(fac >= 1.0f)) {
120  return (float)M_PI / 2.0f;
121  }
122  else {
123  return asinf(fac);
124  }
125 }
126 
127 MINLINE float sasqrt(float fac)
128 {
129  if (UNLIKELY(fac <= 0.0f)) {
130  return 0.0f;
131  }
132  else {
133  return sqrtf(fac);
134  }
135 }
136 
137 MINLINE float saacosf(float fac)
138 {
139  if (UNLIKELY(fac <= -1.0f)) {
140  return (float)M_PI;
141  }
142  else if (UNLIKELY(fac >= 1.0f)) {
143  return 0.0f;
144  }
145  else {
146  return acosf(fac);
147  }
148 }
149 
150 MINLINE float saasinf(float fac)
151 {
152  if (UNLIKELY(fac <= -1.0f)) {
153  return (float)-M_PI / 2.0f;
154  }
155  else if (UNLIKELY(fac >= 1.0f)) {
156  return (float)M_PI / 2.0f;
157  }
158  else {
159  return asinf(fac);
160  }
161 }
162 
163 MINLINE float sasqrtf(float fac)
164 {
165  if (UNLIKELY(fac <= 0.0f)) {
166  return 0.0f;
167  }
168  else {
169  return sqrtf(fac);
170  }
171 }
172 
173 MINLINE float interpf(float target, float origin, float fac)
174 {
175  return (fac * target) + (1.0f - fac) * origin;
176 }
177 
178 MINLINE double interpd(double target, double origin, double fac)
179 {
180  return (fac * target) + (1.0f - fac) * origin;
181 }
182 
183 MINLINE float ratiof(float min, float max, float pos)
184 {
185  float range = max - min;
186  return range == 0 ? 0 : ((pos - min) / range);
187 }
188 
189 MINLINE double ratiod(double min, double max, double pos)
190 {
191  double range = max - min;
192  return range == 0 ? 0 : ((pos - min) / range);
193 }
194 
195 /* Map a normalized value, i.e. from interval [0, 1] to interval [a, b] */
196 MINLINE float scalenorm(float a, float b, float x)
197 {
198  BLI_assert(x <= 1 && x >= 0);
199  return (x * (b - a)) + a;
200 }
201 
202 /* used for zoom values*/
203 MINLINE float power_of_2(float val)
204 {
205  return (float)pow(2.0, ceil(log((double)val) / M_LN2));
206 }
207 
209 {
210  return (n & (n - 1)) == 0;
211 }
212 
214 {
215  if (is_power_of_2_i(n)) {
216  return n;
217  }
218 
219  do {
220  n = n & (n - 1);
221  } while (!is_power_of_2_i(n));
222 
223  return n * 2;
224 }
225 
227 {
228  while (!is_power_of_2_i(n)) {
229  n = n & (n - 1);
230  }
231 
232  return n;
233 }
234 
235 MINLINE unsigned int power_of_2_max_u(unsigned int x)
236 {
237  x -= 1;
238  x |= (x >> 1);
239  x |= (x >> 2);
240  x |= (x >> 4);
241  x |= (x >> 8);
242  x |= (x >> 16);
243  return x + 1;
244 }
245 
246 MINLINE unsigned int power_of_2_min_u(unsigned int x)
247 {
248  x |= (x >> 1);
249  x |= (x >> 2);
250  x |= (x >> 4);
251  x |= (x >> 8);
252  x |= (x >> 16);
253  return x - (x >> 1);
254 }
255 
256 MINLINE unsigned int log2_floor_u(unsigned int x)
257 {
258  return x <= 1 ? 0 : 1 + log2_floor_u(x >> 1);
259 }
260 
261 MINLINE unsigned int log2_ceil_u(unsigned int x)
262 {
263  if (is_power_of_2_i((int)x)) {
264  return log2_floor_u(x);
265  }
266  else {
267  return log2_floor_u(x) + 1;
268  }
269 }
270 
271 /* rounding and clamping */
272 
273 #define _round_clamp_fl_impl(arg, ty, min, max) \
274  { \
275  float r = floorf(arg + 0.5f); \
276  if (UNLIKELY(r <= (float)min)) { \
277  return (ty)min; \
278  } \
279  else if (UNLIKELY(r >= (float)max)) { \
280  return (ty)max; \
281  } \
282  else { \
283  return (ty)r; \
284  } \
285  }
286 
287 #define _round_clamp_db_impl(arg, ty, min, max) \
288  { \
289  double r = floor(arg + 0.5); \
290  if (UNLIKELY(r <= (double)min)) { \
291  return (ty)min; \
292  } \
293  else if (UNLIKELY(r >= (double)max)) { \
294  return (ty)max; \
295  } \
296  else { \
297  return (ty)r; \
298  } \
299  }
300 
301 #define _round_fl_impl(arg, ty) \
302  { \
303  return (ty)floorf(arg + 0.5f); \
304  }
305 #define _round_db_impl(arg, ty) \
306  { \
307  return (ty)floor(arg + 0.5); \
308  }
309 
310 MINLINE signed char round_fl_to_char(float a){_round_fl_impl(a, signed char)} MINLINE
311  unsigned char round_fl_to_uchar(float a){_round_fl_impl(a, unsigned char)} MINLINE
313  unsigned short round_fl_to_ushort(float a){_round_fl_impl(a, unsigned short)} MINLINE
315  unsigned int round_fl_to_uint(float a){_round_fl_impl(a, unsigned int)}
316 
317 MINLINE signed char round_db_to_char(double a){_round_db_impl(a, signed char)} MINLINE
318  unsigned char round_db_to_uchar(double a){_round_db_impl(a, unsigned char)} MINLINE
319  short round_db_to_short(double a){_round_db_impl(a, short)} MINLINE
320  unsigned short round_db_to_ushort(double a){_round_db_impl(a, unsigned short)} MINLINE
322  unsigned int round_db_to_uint(double a)
323 {
324  _round_db_impl(a, unsigned int)
325 }
326 
327 #undef _round_fl_impl
328 #undef _round_db_impl
329 
330 MINLINE signed char round_fl_to_char_clamp(float a){
331  _round_clamp_fl_impl(a, signed char, SCHAR_MIN, SCHAR_MAX)} MINLINE
332  unsigned char round_fl_to_uchar_clamp(float a){
333  _round_clamp_fl_impl(a, unsigned char, 0, UCHAR_MAX)} MINLINE
335  _round_clamp_fl_impl(a, short, SHRT_MIN, SHRT_MAX)} MINLINE
336  unsigned short round_fl_to_ushort_clamp(float a){
337  _round_clamp_fl_impl(a, unsigned short, 0, USHRT_MAX)} MINLINE
338  int round_fl_to_int_clamp(float a){_round_clamp_fl_impl(a, int, INT_MIN, INT_MAX)} MINLINE
339  unsigned int round_fl_to_uint_clamp(float a){
340  _round_clamp_fl_impl(a, unsigned int, 0, UINT_MAX)}
341 
342 MINLINE signed char round_db_to_char_clamp(double a){
343  _round_clamp_db_impl(a, signed char, SCHAR_MIN, SCHAR_MAX)} MINLINE
344  unsigned char round_db_to_uchar_clamp(double a){
345  _round_clamp_db_impl(a, unsigned char, 0, UCHAR_MAX)} MINLINE
346  short round_db_to_short_clamp(double a){
347  _round_clamp_db_impl(a, short, SHRT_MIN, SHRT_MAX)} MINLINE
348  unsigned short round_db_to_ushort_clamp(double a){
349  _round_clamp_db_impl(a, unsigned short, 0, USHRT_MAX)} MINLINE
350  int round_db_to_int_clamp(double a){_round_clamp_db_impl(a, int, INT_MIN, INT_MAX)} MINLINE
351  unsigned int round_db_to_uint_clamp(double a)
352 {
353  _round_clamp_db_impl(a, unsigned int, 0, UINT_MAX)
354 }
355 
356 #undef _round_clamp_fl_impl
357 #undef _round_clamp_db_impl
358 
359 /* integer division that rounds 0.5 up, particularly useful for color blending
360  * with integers, to avoid gradual darkening when rounding down */
361 MINLINE int divide_round_i(int a, int b)
362 {
363  return (2 * a + b) / (2 * b);
364 }
365 
370 MINLINE int divide_floor_i(int a, int b)
371 {
372  int d = a / b;
373  int r = a % b; /* Optimizes into a single division. */
374  return r ? d - ((a < 0) ^ (b < 0)) : d;
375 }
376 
381 {
382  return (a + b - 1) / b;
383 }
384 
388 MINLINE int mod_i(int i, int n)
389 {
390  return (i % n + n) % n;
391 }
392 
393 MINLINE float fractf(float a)
394 {
395  return a - floorf(a);
396 }
397 
398 /* Adapted from godot-engine math_funcs.h. */
399 MINLINE float wrapf(float value, float max, float min)
400 {
401  float range = max - min;
402  return (range != 0.0f) ? value - (range * floorf((value - min) / range)) : min;
403 }
404 
405 MINLINE float pingpongf(float value, float scale)
406 {
407  if (scale == 0.0f) {
408  return 0.0f;
409  }
410  return fabsf(fractf((value - scale) / (scale * 2.0f)) * scale * 2.0f - scale);
411 }
412 
413 // Square.
414 
415 MINLINE int square_s(short a)
416 {
417  return a * a;
418 }
419 
421 {
422  return a * a;
423 }
424 
425 MINLINE unsigned int square_uint(unsigned int a)
426 {
427  return a * a;
428 }
429 
430 MINLINE int square_uchar(unsigned char a)
431 {
432  return a * a;
433 }
434 
435 MINLINE float square_f(float a)
436 {
437  return a * a;
438 }
439 
440 MINLINE double square_d(double a)
441 {
442  return a * a;
443 }
444 
445 // Cube.
446 
447 MINLINE int cube_s(short a)
448 {
449  return a * a * a;
450 }
451 
452 MINLINE int cube_i(int a)
453 {
454  return a * a * a;
455 }
456 
457 MINLINE unsigned int cube_uint(unsigned int a)
458 {
459  return a * a * a;
460 }
461 
462 MINLINE int cube_uchar(unsigned char a)
463 {
464  return a * a * a;
465 }
466 
467 MINLINE float cube_f(float a)
468 {
469  return a * a * a;
470 }
471 
472 MINLINE double cube_d(double a)
473 {
474  return a * a * a;
475 }
476 
477 // Min/max
478 
479 MINLINE float min_ff(float a, float b)
480 {
481  return (a < b) ? a : b;
482 }
483 MINLINE float max_ff(float a, float b)
484 {
485  return (a > b) ? a : b;
486 }
487 /* See: https://www.iquilezles.org/www/articles/smin/smin.htm. */
488 MINLINE float smoothminf(float a, float b, float c)
489 {
490  if (c != 0.0f) {
491  float h = max_ff(c - fabsf(a - b), 0.0f) / c;
492  return min_ff(a, b) - h * h * h * c * (1.0f / 6.0f);
493  }
494  else {
495  return min_ff(a, b);
496  }
497 }
498 
499 MINLINE double min_dd(double a, double b)
500 {
501  return (a < b) ? a : b;
502 }
503 MINLINE double max_dd(double a, double b)
504 {
505  return (a > b) ? a : b;
506 }
507 
508 MINLINE int min_ii(int a, int b)
509 {
510  return (a < b) ? a : b;
511 }
512 MINLINE int max_ii(int a, int b)
513 {
514  return (b < a) ? a : b;
515 }
516 
517 MINLINE float min_fff(float a, float b, float c)
518 {
519  return min_ff(min_ff(a, b), c);
520 }
521 MINLINE float max_fff(float a, float b, float c)
522 {
523  return max_ff(max_ff(a, b), c);
524 }
525 
526 MINLINE int min_iii(int a, int b, int c)
527 {
528  return min_ii(min_ii(a, b), c);
529 }
530 MINLINE int max_iii(int a, int b, int c)
531 {
532  return max_ii(max_ii(a, b), c);
533 }
534 
535 MINLINE float min_ffff(float a, float b, float c, float d)
536 {
537  return min_ff(min_fff(a, b, c), d);
538 }
539 MINLINE float max_ffff(float a, float b, float c, float d)
540 {
541  return max_ff(max_fff(a, b, c), d);
542 }
543 
544 MINLINE int min_iiii(int a, int b, int c, int d)
545 {
546  return min_ii(min_iii(a, b, c), d);
547 }
548 MINLINE int max_iiii(int a, int b, int c, int d)
549 {
550  return max_ii(max_iii(a, b, c), d);
551 }
552 
553 MINLINE size_t min_zz(size_t a, size_t b)
554 {
555  return (a < b) ? a : b;
556 }
557 MINLINE size_t max_zz(size_t a, size_t b)
558 {
559  return (b < a) ? a : b;
560 }
561 
562 MINLINE char min_cc(char a, char b)
563 {
564  return (a < b) ? a : b;
565 }
566 MINLINE char max_cc(char a, char b)
567 {
568  return (b < a) ? a : b;
569 }
570 
571 MINLINE int clamp_i(int value, int min, int max)
572 {
573  return min_ii(max_ii(value, min), max);
574 }
575 
576 MINLINE float clamp_f(float value, float min, float max)
577 {
578  if (value > max) {
579  return max;
580  }
581  else if (value < min) {
582  return min;
583  }
584  return value;
585 }
586 
587 MINLINE size_t clamp_z(size_t value, size_t min, size_t max)
588 {
589  return min_zz(max_zz(value, min), max);
590 }
591 
597 MINLINE int compare_ff(float a, float b, const float max_diff)
598 {
599  return fabsf(a - b) <= max_diff;
600 }
601 
613 MINLINE int compare_ff_relative(float a, float b, const float max_diff, const int max_ulps)
614 {
615  union {
616  float f;
617  int i;
618  } ua, ub;
619 
620  BLI_assert(sizeof(float) == sizeof(int));
621  BLI_assert(max_ulps < (1 << 22));
622 
623  if (fabsf(a - b) <= max_diff) {
624  return 1;
625  }
626 
627  ua.f = a;
628  ub.f = b;
629 
630  /* Important to compare sign from integers, since (-0.0f < 0) is false
631  * (though this shall not be an issue in common cases)... */
632  return ((ua.i < 0) != (ub.i < 0)) ? 0 : (abs(ua.i - ub.i) <= max_ulps) ? 1 : 0;
633 }
634 
635 MINLINE float signf(float f)
636 {
637  return (f < 0.0f) ? -1.0f : 1.0f;
638 }
639 
640 MINLINE float compatible_signf(float f)
641 {
642  if (f > 0.0f) {
643  return 1.0f;
644  }
645  if (f < 0.0f) {
646  return -1.0f;
647  }
648  else {
649  return 0.0f;
650  }
651 }
652 
653 MINLINE int signum_i_ex(float a, float eps)
654 {
655  if (a > eps) {
656  return 1;
657  }
658  if (a < -eps) {
659  return -1;
660  }
661  else {
662  return 0;
663  }
664 }
665 
666 MINLINE int signum_i(float a)
667 {
668  if (a > 0.0f) {
669  return 1;
670  }
671  if (a < 0.0f) {
672  return -1;
673  }
674  else {
675  return 0;
676  }
677 }
678 
683 MINLINE int integer_digits_f(const float f)
684 {
685  return (f == 0.0f) ? 0 : (int)floor(log10(fabs(f))) + 1;
686 }
687 
692 MINLINE int integer_digits_d(const double d)
693 {
694  return (d == 0.0) ? 0 : (int)floor(log10(fabs(d))) + 1;
695 }
696 
697 MINLINE int integer_digits_i(const int i)
698 {
699  return (int)log10((double)i) + 1;
700 }
701 
702 /* Internal helpers for SSE2 implementation.
703  *
704  * NOTE: Are to be called ONLY from inside `#ifdef BLI_HAVE_SSE2` !!!
705  */
706 
707 #ifdef BLI_HAVE_SSE2
708 
709 /* Calculate initial guess for arg^exp based on float representation
710  * This method gives a constant bias, which can be easily compensated by
711  * multiplying with bias_coeff.
712  * Gives better results for exponents near 1 (e. g. 4/5).
713  * exp = exponent, encoded as uint32_t
714  * e2coeff = 2^(127/exponent - 127) * bias_coeff^(1/exponent), encoded as
715  * uint32_t
716  *
717  * We hope that exp and e2coeff gets properly inlined
718  */
719 MALWAYS_INLINE __m128 _bli_math_fastpow(const int exp, const int e2coeff, const __m128 arg)
720 {
721  __m128 ret;
722  ret = _mm_mul_ps(arg, _mm_castsi128_ps(_mm_set1_epi32(e2coeff)));
723  ret = _mm_cvtepi32_ps(_mm_castps_si128(ret));
724  ret = _mm_mul_ps(ret, _mm_castsi128_ps(_mm_set1_epi32(exp)));
725  ret = _mm_castsi128_ps(_mm_cvtps_epi32(ret));
726  return ret;
727 }
728 
729 /* Improve x ^ 1.0f/5.0f solution with Newton-Raphson method */
730 MALWAYS_INLINE __m128 _bli_math_improve_5throot_solution(const __m128 old_result, const __m128 x)
731 {
732  __m128 approx2 = _mm_mul_ps(old_result, old_result);
733  __m128 approx4 = _mm_mul_ps(approx2, approx2);
734  __m128 t = _mm_div_ps(x, approx4);
735  __m128 summ = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(4.0f), old_result), t); /* FMA. */
736  return _mm_mul_ps(summ, _mm_set1_ps(1.0f / 5.0f));
737 }
738 
739 /* Calculate powf(x, 2.4). Working domain: 1e-10 < x < 1e+10 */
740 MALWAYS_INLINE __m128 _bli_math_fastpow24(const __m128 arg)
741 {
742  /* max, avg and |avg| errors were calculated in gcc without FMA instructions
743  * The final precision should be better than powf in glibc */
744 
745  /* Calculate x^4/5, coefficient 0.994 was constructed manually to minimize
746  * avg error.
747  */
748  /* 0x3F4CCCCD = 4/5 */
749  /* 0x4F55A7FB = 2^(127/(4/5) - 127) * 0.994^(1/(4/5)) */
750  /* error max = 0.17, avg = 0.0018, |avg| = 0.05 */
751  __m128 x = _bli_math_fastpow(0x3F4CCCCD, 0x4F55A7FB, arg);
752  __m128 arg2 = _mm_mul_ps(arg, arg);
753  __m128 arg4 = _mm_mul_ps(arg2, arg2);
754  /* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */
755  x = _bli_math_improve_5throot_solution(x, arg4);
756  /* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */
757  x = _bli_math_improve_5throot_solution(x, arg4);
758  /* error max = 6.1e-07 avg = 5.2e-08 |avg| = 1.1e-07 */
759  x = _bli_math_improve_5throot_solution(x, arg4);
760  return _mm_mul_ps(x, _mm_mul_ps(x, x));
761 }
762 
763 /* Calculate powf(x, 1.0f / 2.4) */
764 MALWAYS_INLINE __m128 _bli_math_fastpow512(const __m128 arg)
765 {
766  /* 5/12 is too small, so compute the 4th root of 20/12 instead.
767  * 20/12 = 5/3 = 1 + 2/3 = 2 - 1/3. 2/3 is a suitable argument for fastpow.
768  * weighting coefficient: a^-1/2 = 2 a; a = 2^-2/3
769  */
770  __m128 xf = _bli_math_fastpow(0x3f2aaaab, 0x5eb504f3, arg);
771  __m128 xover = _mm_mul_ps(arg, xf);
772  __m128 xfm1 = _mm_rsqrt_ps(xf);
773  __m128 x2 = _mm_mul_ps(arg, arg);
774  __m128 xunder = _mm_mul_ps(x2, xfm1);
775  /* sqrt2 * over + 2 * sqrt2 * under */
776  __m128 xavg = _mm_mul_ps(_mm_set1_ps(1.0f / (3.0f * 0.629960524947437f) * 0.999852f),
777  _mm_add_ps(xover, xunder));
778  xavg = _mm_mul_ps(xavg, _mm_rsqrt_ps(xavg));
779  xavg = _mm_mul_ps(xavg, _mm_rsqrt_ps(xavg));
780  return xavg;
781 }
782 
783 MALWAYS_INLINE __m128 _bli_math_blend_sse(const __m128 mask, const __m128 a, const __m128 b)
784 {
785  return _mm_or_ps(_mm_and_ps(mask, a), _mm_andnot_ps(mask, b));
786 }
787 
788 #endif /* BLI_HAVE_SSE2 */
789 
790 /* Low level conversion functions */
791 MINLINE unsigned char unit_float_to_uchar_clamp(float val)
792 {
793  return (unsigned char)((
794  (val <= 0.0f) ? 0 : ((val > (1.0f - 0.5f / 255.0f)) ? 255 : ((255.0f * val) + 0.5f))));
795 }
796 #define unit_float_to_uchar_clamp(val) \
797  ((CHECK_TYPE_INLINE(val, float)), unit_float_to_uchar_clamp(val))
798 
799 MINLINE unsigned short unit_float_to_ushort_clamp(float val)
800 {
801  return (unsigned short)((val >= 1.0f - 0.5f / 65535) ?
802  65535 :
803  (val <= 0.0f) ? 0 : (val * 65535.0f + 0.5f));
804 }
805 #define unit_float_to_ushort_clamp(val) \
806  ((CHECK_TYPE_INLINE(val, float)), unit_float_to_ushort_clamp(val))
807 
808 MINLINE unsigned char unit_ushort_to_uchar(unsigned short val)
809 {
810  return (unsigned char)(((val) >= 65535 - 128) ? 255 : ((val) + 128) >> 8);
811 }
812 #define unit_ushort_to_uchar(val) \
813  ((CHECK_TYPE_INLINE(val, unsigned short)), unit_ushort_to_uchar(val))
814 
815 #define unit_float_to_uchar_clamp_v3(v1, v2) \
816  { \
817  (v1)[0] = unit_float_to_uchar_clamp((v2[0])); \
818  (v1)[1] = unit_float_to_uchar_clamp((v2[1])); \
819  (v1)[2] = unit_float_to_uchar_clamp((v2[2])); \
820  } \
821  ((void)0)
822 #define unit_float_to_uchar_clamp_v4(v1, v2) \
823  { \
824  (v1)[0] = unit_float_to_uchar_clamp((v2[0])); \
825  (v1)[1] = unit_float_to_uchar_clamp((v2[1])); \
826  (v1)[2] = unit_float_to_uchar_clamp((v2[2])); \
827  (v1)[3] = unit_float_to_uchar_clamp((v2[3])); \
828  } \
829  ((void)0)
830 
831 #ifdef __cplusplus
832 }
833 #endif
834 
835 #endif /* __MATH_BASE_INLINE_C__ */
typedef float(TangentPoint)[2]
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define M_LN2
Definition: BLI_math_base.h:71
#define M_PI
Definition: BLI_math_base.h:38
#define MALWAYS_INLINE
#define MINLINE
unsigned int uint
Definition: BLI_sys_types.h:83
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
uint pos
#define UINT_MAX
Definition: hash_md5.c:58
#define asinf(x)
#define floorf(x)
#define acosf(x)
#define fabsf(x)
#define sqrtf(x)
MINLINE int round_fl_to_int_clamp(float a)
MINLINE unsigned char round_fl_to_uchar(float a)
MINLINE float max_fff(float a, float b, float c)
MINLINE float saacos(float fac)
#define _round_clamp_fl_impl(arg, ty, min, max)
MINLINE unsigned short round_fl_to_ushort_clamp(float a)
MINLINE float max_ffff(float a, float b, float c, float d)
MINLINE unsigned int round_db_to_uint_clamp(double a)
MINLINE unsigned int log2_ceil_u(unsigned int x)
MINLINE signed char round_fl_to_char(float a)
MINLINE int power_of_2_min_i(int n)
MINLINE int round_fl_to_int(float a)
MINLINE short round_db_to_short_clamp(double a)
MINLINE signed char round_db_to_char_clamp(double a)
MINLINE float max_ff(float a, float b)
MINLINE unsigned int cube_uint(unsigned int a)
MINLINE size_t min_zz(size_t a, size_t b)
MINLINE int min_ii(int a, int b)
MINLINE uint divide_ceil_u(uint a, uint b)
MINLINE short round_db_to_short(double a)
MINLINE float saasinf(float fac)
MINLINE int power_of_2_max_i(int n)
MINLINE float fractf(float a)
MINLINE int compare_ff(float a, float b, const float max_diff)
MINLINE float power_of_2(float val)
MINLINE float sasqrtf(float fac)
MINLINE float min_ffff(float a, float b, float c, float d)
MINLINE unsigned int power_of_2_max_u(unsigned int x)
#define _round_fl_impl(arg, ty)
MINLINE int cube_i(int a)
#define _round_db_impl(arg, ty)
MINLINE unsigned short round_fl_to_ushort(float a)
MINLINE float pow2f(float x)
MINLINE unsigned int round_fl_to_uint_clamp(float a)
MINLINE double square_d(double a)
#define unit_float_to_ushort_clamp(val)
MINLINE double ratiod(double min, double max, double pos)
MINLINE float clamp_f(float value, float min, float max)
MINLINE int divide_floor_i(int a, int b)
MINLINE float min_ff(float a, float b)
MINLINE size_t max_zz(size_t a, size_t b)
MINLINE int cube_s(short a)
MINLINE int integer_digits_d(const double d)
MINLINE int square_i(int a)
MINLINE short round_fl_to_short_clamp(float a)
MINLINE float pow5f(float x)
MINLINE int max_ii(int a, int b)
MINLINE short round_fl_to_short(float a)
MINLINE unsigned int round_db_to_uint(double a)
#define unit_float_to_uchar_clamp(val)
MINLINE unsigned int power_of_2_min_u(unsigned int x)
MINLINE double min_dd(double a, double b)
MINLINE signed char round_fl_to_char_clamp(float a)
MINLINE float smoothminf(float a, float b, float c)
MINLINE float cube_f(float a)
MINLINE unsigned short round_db_to_ushort_clamp(double a)
MINLINE float scalenorm(float a, float b, float x)
MINLINE unsigned char round_fl_to_uchar_clamp(float a)
MINLINE double cube_d(double a)
MINLINE int min_iii(int a, int b, int c)
MINLINE int divide_round_i(int a, int b)
MINLINE int integer_digits_f(const float f)
MINLINE int integer_digits_i(const int i)
MINLINE int mod_i(int i, int n)
#define unit_ushort_to_uchar(val)
MINLINE double interpd(double target, double origin, double fac)
MINLINE float square_f(float a)
MINLINE unsigned int round_fl_to_uint(float a)
MINLINE float pingpongf(float value, float scale)
#define UNLIKELY(x)
MINLINE float interpf(float target, float origin, float fac)
MINLINE float sqrtf_signed(float f)
MINLINE double max_dd(double a, double b)
MINLINE int round_db_to_int_clamp(double a)
MINLINE char min_cc(char a, char b)
MINLINE signed char round_db_to_char(double a)
MINLINE int is_power_of_2_i(int n)
MINLINE float pow3f(float x)
MINLINE int compare_ff_relative(float a, float b, const float max_diff, const int max_ulps)
MINLINE double sqrt3d(double d)
MINLINE int round_db_to_int(double a)
MINLINE int max_iiii(int a, int b, int c, int d)
MINLINE float min_fff(float a, float b, float c)
MINLINE int signum_i_ex(float a, float eps)
MINLINE int min_iiii(int a, int b, int c, int d)
MINLINE float saasin(float fac)
MINLINE unsigned int log2_floor_u(unsigned int x)
MINLINE float signf(float f)
MINLINE int max_iii(int a, int b, int c)
MINLINE size_t clamp_z(size_t value, size_t min, size_t max)
MINLINE unsigned short round_db_to_ushort(double a)
MINLINE int clamp_i(int value, int min, int max)
MINLINE int signum_i(float a)
MINLINE float ratiof(float min, float max, float pos)
#define _round_clamp_db_impl(arg, ty, min, max)
MINLINE int cube_uchar(unsigned char a)
MINLINE unsigned int square_uint(unsigned int a)
MINLINE int square_s(short a)
MINLINE float compatible_signf(float f)
MINLINE float sasqrt(float fac)
MINLINE unsigned char round_db_to_uchar_clamp(double a)
MINLINE int square_uchar(unsigned char a)
MINLINE float pow4f(float x)
MINLINE float sqrt3f(float f)
MINLINE char max_cc(char a, char b)
MINLINE float pow7f(float x)
MINLINE float wrapf(float value, float max, float min)
MINLINE unsigned char round_db_to_uchar(double a)
MINLINE float saacosf(float fac)
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
Definition: rall1d.h:359
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:303
INLINE Rall1d< T, V, S > exp(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:295
const btScalar eps
Definition: poly34.cpp:11
return ret
#define min(a, b)
Definition: sort.c:51
float max
__forceinline const avxi abs(const avxi &a)
Definition: util_avxi.h:186
ccl_device_inline float2 floor(const float2 &a)
ccl_device_inline float2 fabs(const float2 &a)
ccl_device_inline float3 ceil(const float3 &a)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)