54# define NAN_FLT __builtin_nanf("")
57# define NAN_FLT (*((float *)(&NAN_INT)))
64#ifdef BLI_MATH_GCC_WARN_PRAGMA
65# pragma GCC diagnostic push
66# pragma GCC diagnostic ignored "-Wredundant-decls"
299#ifdef BLI_MATH_GCC_WARN_PRAGMA
300# pragma GCC diagnostic pop
308# define BLI_ASSERT_UNIT_EPSILON 0.0002f
309# define BLI_ASSERT_UNIT_EPSILON_DB 0.0002
315# define BLI_ASSERT_UNIT_V3(v) \
317 const float _test_unit = len_squared_v3(v); \
318 BLI_assert(!(fabsf(_test_unit - 1.0f) >= BLI_ASSERT_UNIT_EPSILON) || \
319 !(fabsf(_test_unit) >= BLI_ASSERT_UNIT_EPSILON)); \
323# define BLI_ASSERT_UNIT_V2(v) \
325 const float _test_unit = len_squared_v2(v); \
326 BLI_assert(!(fabsf(_test_unit - 1.0f) >= BLI_ASSERT_UNIT_EPSILON) || \
327 !(fabsf(_test_unit) >= BLI_ASSERT_UNIT_EPSILON)); \
331# define BLI_ASSERT_UNIT_QUAT(q) \
333 const float _test_unit = dot_qtqt(q, q); \
334 BLI_assert(!(fabsf(_test_unit - 1.0f) >= BLI_ASSERT_UNIT_EPSILON * 10) || \
335 !(fabsf(_test_unit) >= BLI_ASSERT_UNIT_EPSILON * 10)); \
339# define BLI_ASSERT_ZERO_M3(m) \
341 BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 9) != 0.0); \
345# define BLI_ASSERT_ZERO_M4(m) \
347 BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 16) != 0.0); \
350# define BLI_ASSERT_UNIT_M3(m) \
352 BLI_ASSERT_UNIT_V3((m)[0]); \
353 BLI_ASSERT_UNIT_V3((m)[1]); \
354 BLI_ASSERT_UNIT_V3((m)[2]); \
358# define BLI_ASSERT_UNIT_V2(v) (void)(v)
359# define BLI_ASSERT_UNIT_V3(v) (void)(v)
360# define BLI_ASSERT_UNIT_QUAT(v) (void)(v)
361# define BLI_ASSERT_ZERO_M3(m) (void)(m)
362# define BLI_ASSERT_ZERO_M4(m) (void)(m)
363# define BLI_ASSERT_UNIT_M3(m) (void)(m)
unsigned long long int uint64_t
ccl_device_inline float signf(const float f)
ccl_device_inline int power_of_2(const int a)
MINLINE float min_ff(float a, float b)
MINLINE unsigned char round_db_to_uchar_clamp(double a)
MINLINE unsigned int round_fl_to_uint(float a)
MINLINE int round_fl_to_int_clamp(float a)
MINLINE double min_dd(double a, double b)
MINLINE short round_fl_to_short(float a)
MINLINE int mod_i(int i, int n)
MINLINE int compare_ff_relative(float a, float b, float max_diff, int max_ulps)
MINLINE unsigned char round_fl_to_uchar(float a)
MINLINE int round_fl_to_int(float a)
MINLINE int square_i(int a)
MINLINE int power_of_2_min_i(int n)
MINLINE int round_db_to_int_clamp(double a)
MINLINE double interpd(double target, double origin, double t)
MINLINE int integer_digits_i(int i)
MINLINE int power_of_2_max_i(int n)
double double_round(double x, int ndigits)
MINLINE uint max_uu(uint a, uint b)
MINLINE int signum_i_ex(float a, float eps)
MINLINE int max_ii(int a, int b)
float ceil_power_of_10(float f)
MINLINE bool compare_threshold_relative(float value1, float value2, float thresh)
MINLINE float cube_f(float a)
MINLINE uint ulp_diff_ff(float a, float b)
MINLINE unsigned int power_of_2_max_u(unsigned int x)
MINLINE unsigned int log2_ceil_u(unsigned int x)
MINLINE float sqrtf_signed(float f)
MINLINE double ratiod(double min, double max, double pos)
MINLINE float increment_ulp(float value)
MINLINE int integer_digits_f(float f)
MINLINE int cube_i(int a)
MINLINE int divide_round_i(int a, int b)
MINLINE uint64_t ceil_to_multiple_ul(uint64_t a, uint64_t b)
MINLINE uint64_t divide_ceil_ul(uint64_t a, uint64_t b)
MINLINE int signum_i(float a)
MINLINE double max_dd(double a, double b)
MINLINE float sqrt3f(float f)
MINLINE float decrement_ulp(float value)
MINLINE double sqrt3d(double d)
int pow_i(int base, int exp)
MINLINE unsigned int log2_floor_u(unsigned int x)
MINLINE float ratiof(float min, float max, float pos)
MINLINE float max_ff(float a, float b)
float floor_power_of_10(float f)
MINLINE uint divide_ceil_u(uint a, uint b)
MINLINE float square_f(float a)
MINLINE unsigned char round_fl_to_uchar_clamp(float a)
MINLINE float interpf(float target, float origin, float t)
MINLINE float round_to_even(float f)
MINLINE int square_s(short a)
MINLINE uint ceil_to_multiple_u(uint a, uint b)
MINLINE short round_db_to_short_clamp(double a)
MINLINE int integer_digits_d(double d)
MINLINE int is_power_of_2_i(int n)
MINLINE int min_ii(int a, int b)
MINLINE int clamp_i(int value, int min, int max)
MINLINE unsigned int square_uint(unsigned int a)
MINLINE int compare_ff(float a, float b, float max_diff)
MINLINE int round_db_to_int(double a)
MINLINE float floored_fmod(float f, float n)
MINLINE float clamp_f(float value, float min, float max)
MINLINE uint min_uu(uint a, uint b)