Blender V5.3
math_base.h File Reference
#include "util/defines.h"
#include "util/types_base.h"
#include <cfloat>
#include <cmath>
#include <bit>

Go to the source code of this file.

Classes

struct  Interval< T >
struct  Extrema< T >

Macros

#define M_PI_F   (3.1415926535897932f)
#define M_PI_2_F   (1.5707963267948966f)
#define M_PI_4_F   (0.7853981633974830f)
#define M_1_PI_F   (0.3183098861837067f)
#define M_2_PI_F   (0.6366197723675813f)
#define M_1_2PI_F   (0.1591549430918953f)
#define M_1_4PI_F   (0.0795774715459476f)
#define M_SQRT_PI_8_F   (0.6266570686577501f)
#define M_LN_2PI_F   (1.8378770664093454f)
#define M_2PI_F   (6.2831853071795864f)
#define M_4PI_F   (12.566370614359172f)
#define M_PI_4F   0.78539816339744830962f
#define M_SQRT2_F   (1.4142135623730950f)
#define M_CBRT2_F   1.2599210498948732f
#define M_SQRT1_2F   0.70710678118654752440f
#define M_SQRT3_F   (1.7320508075688772f)
#define M_LN2_F   (0.6931471805599453f)
#define M_LN10_F   (2.3025850929940457f)
#define __has_builtin(v)

Functions

ccl_device_inline int abs (const int x)
ccl_device_inline int max (const int a, const int b)
ccl_device_inline int min (const int a, const int b)
ccl_device_inline uint32_t max (const uint32_t a, const uint32_t b)
ccl_device_inline uint32_t min (const uint32_t a, const uint32_t b)
ccl_device_inline uint64_t max (const uint64_t a, const uint64_t b)
ccl_device_inline uint64_t min (const uint64_t a, const uint64_t b)
template<class T>
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > max (T a, T b)
template<class T>
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > min (T a, T b)
ccl_device_inline float max (const float a, const float b)
ccl_device_inline float min (const float a, const float b)
ccl_device_inline double max (const double a, const double b)
ccl_device_inline double min (const double a, const double b)
template<typename T>
ccl_device_inline T min4 (const T &a, const T &b, const T &c, const T &d)
template<typename T>
ccl_device_inline T max4 (const T &a, const T &b, const T &c, const T &d)
ccl_device_inline float min4 (const float a, const float b, float c, const float d)
ccl_device_inline float max4 (const float a, const float b, float c, const float d)
template<typename T>
ccl_device_inline T make_zero ()
ccl_device_template_spec float make_zero ()
ccl_device_inline int as_int (const uint i)
ccl_device_inline uint as_uint (const int i)
ccl_device_inline uint as_uint (const float f)
ccl_device_inline int __float_as_int (const float f)
ccl_device_inline float __int_as_float (const int i)
ccl_device_inline uint __float_as_uint (const float f)
ccl_device_inline float __uint_as_float (const uint i)
template<typename T>
ccl_device_inline uint pointer_pack_to_uint_0 (T *ptr)
template<typename T>
ccl_device_inline uint pointer_pack_to_uint_1 (T *ptr)
template<typename T>
ccl_device_inline T * pointer_unpack_from_uint (const uint a, const uint b)
ccl_device_inline uint uint16_pack_to_uint (const uint a, const uint b)
ccl_device_inline uint uint16_unpack_from_uint_0 (const uint i)
ccl_device_inline uint uint16_unpack_from_uint_1 (const uint i)
ccl_device_inline bool isnan_safe (const float f)
ccl_device_inline bool isfinite_safe (const float f)
ccl_device_inline float ensure_finite (const float v)
ccl_device_inline int clamp (const int a, const int mn, const int mx)
ccl_device_inline float clamp (const float a, const float mn, const float mx)
ccl_device_inline float smoothstep (const float edge0, const float edge1, const float x)
template<typename T1, typename T2>
ccl_device_inline T1 mix (const T1 a, const T1 b, const T2 t)
template<typename T1, typename T2>
ccl_device_inline T1 endvalue_preserving_mix (const T1 a, const T1 b, const T2 t)
ccl_device_inline float saturatef (const float a)
ccl_device_inline int float_to_int (const float f)
ccl_device_inline int floor_to_int (const float f)
ccl_device_inline float floorfrac (const float x, ccl_private int *i)
ccl_device_inline int ceil_to_int (const float f)
ccl_device_inline float fractf (const float x)
ccl_device_inline float wrapf (const float value, const float max, const float min)
ccl_device_inline float pingpongf (const float a, const float b)
ccl_device_inline float smoothminf (const float a, const float b, float k)
ccl_device_inline float signf (const float f)
ccl_device_inline float nonzerof (const float f, const float eps)
ccl_device_inline float compatible_atan2 (const float y, const float x)
ccl_device_inline float compatible_signf (const float f)
ccl_device_inline float smoothstepf (const float f)
ccl_device_inline int mod (const int x, const int m)
ccl_device_inline float interp (const float a, const float b, const float t)
ccl_device_inline float inverse_lerp (const float a, const float b, const float x)
ccl_device_inline float cubic_interp (const float a, const float b, float c, const float d, float x)
ccl_device_inline float safe_sqrtf (const float f)
ccl_device_inline float inversesqrtf (const float f)
ccl_device float safe_asinf (const float a)
ccl_device float safe_acosf (const float a)
ccl_device float compatible_powf (const float x, const float y)
ccl_device float safe_powf (const float a, const float b)
ccl_device float safe_divide (const float a, const float b)
ccl_device float safe_logf (const float a, const float b)
ccl_device float safe_modulo (const float a, const float b)
ccl_device float safe_floored_modulo (const float a, const float b)
ccl_device_inline float sqr (const float a)
ccl_device_inline float sin_from_cos (const float c)
ccl_device_inline float cos_from_sin (const float s)
ccl_device_inline float sin_sqr_to_one_minus_cos (const float s_sq)
ccl_device_inline float one_minus_cos (const float angle)
ccl_device_inline int power_of_2 (const int a)
ccl_device_inline float pow20 (const float a)
ccl_device_inline float pow22 (const float a)
ccl_device_inline float beta (const float x, const float y)
ccl_device_inline float xor_mask (const float x, const uint y)
ccl_device_inline float or_mask (const float x, const uint y)
ccl_device float bits_to_01 (const uint bits)
ccl_device_inline bool is_zero (const float a)
ccl_device_inline uint popcount (const uint x)
ccl_device_inline uint popcount (const uint64_t x)
ccl_device_inline uint count_leading_zeros (const uint x)
ccl_device_inline uint count_trailing_zeros (const uint x)
ccl_device_inline uint find_first_set (const uint x)
ccl_device_inline bool compare_floats (const float a, const float b, float abs_diff, const int ulp_diff)
ccl_device_inline uint next_power_of_two (const uint x)
ccl_device_inline uint prev_power_of_two (const uint x)
ccl_device_inline uint32_t reverse_integer_bits (uint32_t x)
ccl_device_inline bool solve_quadratic (const float a, const float b, const float c, ccl_private float &x1, ccl_private float &x2)
template<typename T1, typename T2>
ccl_device_inline Interval< T1 > operator/= (ccl_private Interval< T1 > &interval, const T2 f)
template<typename T>
ccl_device_inline Interval< T > intervals_intersection (const ccl_private Interval< T > &first, const ccl_private Interval< T > &second)
template<typename T>
ccl_device_inline Extrema< T > operator* (const Extrema< T > a, const T b)
template<typename T>
ccl_device_inline Extrema< T > operator+ (const ccl_private Extrema< T > &a, const ccl_private Extrema< T > &b)
template<typename T>
ccl_device_inline Extrema< T > operator+= (ccl_private Extrema< T > &a, const ccl_private Extrema< T > &b)
template<typename T>
ccl_device_inline Extrema< T > merge (const ccl_private Extrema< T > &a, const ccl_private Extrema< T > &b)
template<typename T>
ccl_device_inline Extrema< T > merge (const ccl_private Extrema< T > &a, const ccl_private T &v)
ccl_device_inline uchar float_to_byte (const float val)
ccl_device_inline float byte_to_float (const uchar val)

Macro Definition Documentation

◆ __has_builtin

#define __has_builtin ( v)
Value:
0

Definition at line 844 of file device/cpu/globals.h.

◆ M_1_2PI_F

#define M_1_2PI_F   (0.1591549430918953f)

Definition at line 49 of file device/cpu/globals.h.

◆ M_1_4PI_F

#define M_1_4PI_F   (0.0795774715459476f)

Definition at line 52 of file device/cpu/globals.h.

◆ M_1_PI_F

#define M_1_PI_F   (0.3183098861837067f)

Definition at line 43 of file device/cpu/globals.h.

◆ M_2_PI_F

#define M_2_PI_F   (0.6366197723675813f)

Definition at line 46 of file device/cpu/globals.h.

◆ M_2PI_F

#define M_2PI_F   (6.2831853071795864f)

Definition at line 63 of file device/cpu/globals.h.

◆ M_4PI_F

#define M_4PI_F   (12.566370614359172f)

Definition at line 66 of file device/cpu/globals.h.

◆ M_CBRT2_F

#define M_CBRT2_F   1.2599210498948732f

Definition at line 77 of file device/cpu/globals.h.

◆ M_LN10_F

#define M_LN10_F   (2.3025850929940457f)

Definition at line 89 of file device/cpu/globals.h.

◆ M_LN2_F

#define M_LN2_F   (0.6931471805599453f)

Definition at line 86 of file device/cpu/globals.h.

◆ M_LN_2PI_F

#define M_LN_2PI_F   (1.8378770664093454f)

Definition at line 58 of file device/cpu/globals.h.

◆ M_PI_2_F

#define M_PI_2_F   (1.5707963267948966f)

Definition at line 37 of file device/cpu/globals.h.

◆ M_PI_4_F

#define M_PI_4_F   (0.7853981633974830f)

Definition at line 40 of file device/cpu/globals.h.

◆ M_PI_4F

#define M_PI_4F   0.78539816339744830962f

Definition at line 69 of file device/cpu/globals.h.

◆ M_PI_F

#define M_PI_F   (3.1415926535897932f)

Definition at line 34 of file device/cpu/globals.h.

◆ M_SQRT1_2F

#define M_SQRT1_2F   0.70710678118654752440f

Definition at line 80 of file device/cpu/globals.h.

◆ M_SQRT2_F

#define M_SQRT2_F   (1.4142135623730950f)

Definition at line 74 of file device/cpu/globals.h.

◆ M_SQRT3_F

#define M_SQRT3_F   (1.7320508075688772f)

Definition at line 83 of file device/cpu/globals.h.

◆ M_SQRT_PI_8_F

#define M_SQRT_PI_8_F   (0.6266570686577501f)

Definition at line 55 of file device/cpu/globals.h.

Function Documentation

◆ __float_as_int()

ccl_device_inline int __float_as_int ( const float f)

Definition at line 271 of file math_base.h.

References __float_as_int, and ccl_device_inline.

◆ __float_as_uint()

ccl_device_inline uint __float_as_uint ( const float f)

Definition at line 291 of file math_base.h.

References __float_as_uint, and ccl_device_inline.

◆ __int_as_float()

ccl_device_inline float __int_as_float ( const int i)

Definition at line 281 of file math_base.h.

References __int_as_float, and ccl_device_inline.

◆ __uint_as_float()

ccl_device_inline float __uint_as_float ( const uint i)

Definition at line 301 of file math_base.h.

References __uint_as_float, and ccl_device_inline.

◆ abs()

ccl_device_inline int abs ( const int x)

Definition at line 129 of file math_base.h.

References abs, ccl_device_inline, and x.

◆ as_int()

ccl_device_inline int as_int ( const uint i)

◆ as_uint() [1/2]

ccl_device_inline uint as_uint ( const float f)

Definition at line 260 of file math_base.h.

References as_uint(), and ccl_device_inline.

◆ as_uint() [2/2]

ccl_device_inline uint as_uint ( const int i)

Definition at line 250 of file math_base.h.

References as_uint(), and ccl_device_inline.

◆ beta()

◆ bits_to_01()

ccl_device float bits_to_01 ( const uint bits)

Definition at line 723 of file math_base.h.

References bits_to_01(), ccl_device, and float.

Referenced by bits_to_01().

◆ byte_to_float()

◆ ceil_to_int()

ccl_device_inline int ceil_to_int ( const float f)

◆ clamp() [1/2]

ccl_device_inline float clamp ( const float a,
const float mn,
const float mx )

Definition at line 385 of file math_base.h.

References ccl_device_inline, clamp(), max, and min.

◆ clamp() [2/2]

ccl_device_inline int clamp ( const int a,
const int mn,
const int mx )

Definition at line 380 of file math_base.h.

References ccl_device_inline, clamp(), max, and min.

◆ compare_floats()

ccl_device_inline bool compare_floats ( const float a,
const float b,
float abs_diff,
const int ulp_diff )

Definition at line 815 of file math_base.h.

References __float_as_int, abs, b, ccl_device_inline, compare_floats(), and fabsf.

Referenced by compare_floats().

◆ compatible_atan2()

ccl_device_inline float compatible_atan2 ( const float y,
const float x )

Definition at line 518 of file math_base.h.

References atan2f, ccl_device_inline, compatible_atan2(), x, and y.

Referenced by compatible_atan2(), and svm_math().

◆ compatible_powf()

ccl_device float compatible_powf ( const float x,
const float y )

Definition at line 595 of file math_base.h.

References ccl_device, compatible_powf(), fmodf, powf, x, and y.

Referenced by compatible_powf(), and safe_powf().

◆ compatible_signf()

ccl_device_inline float compatible_signf ( const float f)

Definition at line 524 of file math_base.h.

References ccl_device_inline, compatible_signf(), and signf().

Referenced by compatible_sign(), compatible_signf(), and svm_math().

◆ cos_from_sin()

ccl_device_inline float cos_from_sin ( const float s)

Definition at line 661 of file math_base.h.

References ccl_device_inline, cos_from_sin(), safe_sqrtf(), and sqr.

◆ count_leading_zeros()

ccl_device_inline uint count_leading_zeros ( const uint x)

◆ count_trailing_zeros()

ccl_device_inline uint count_trailing_zeros ( const uint x)

Definition at line 773 of file math_base.h.

References assert, ccl_device_inline, count_trailing_zeros(), and x.

Referenced by count_trailing_zeros().

◆ cubic_interp()

ccl_device_inline float cubic_interp ( const float a,
const float b,
float c,
const float d,
float x )

Definition at line 560 of file math_base.h.

References b, ccl_device_inline, cubic_interp(), and x.

Referenced by cubic_interp(), interpolate_ies_vertical(), and kernel_ies_interp().

◆ endvalue_preserving_mix()

template<typename T1, typename T2>
ccl_device_inline T1 endvalue_preserving_mix ( const T1 a,
const T1 b,
const T2 t )

Definition at line 427 of file math_base.h.

References b, ccl_device_inline, endvalue_preserving_mix(), T1, and T2.

◆ ensure_finite()

◆ find_first_set()

ccl_device_inline uint find_first_set ( const uint x)

Definition at line 793 of file math_base.h.

References ccl_device_inline, count_leading_zeros(), find_first_set(), and x.

Referenced by find_first_set().

◆ float_to_byte()

◆ float_to_int()

◆ floor_to_int()

ccl_device_inline int floor_to_int ( const float f)

◆ floorfrac()

◆ fractf()

ccl_device_inline float fractf ( const float x)

Definition at line 476 of file math_base.h.

References ccl_device_inline, floorf, fractf, and x.

◆ interp()

ccl_device_inline float interp ( const float a,
const float b,
const float t )

Definition at line 549 of file math_base.h.

References b, ccl_device_inline, and interp().

Referenced by as_data(), as_data(), as_data(), as_data(), camera_sample_perspective(), ClipSegmentToLine(), CurvesNode::constant_fold(), InvertNode::constant_fold(), blender::CustomData_data_transfer(), blender::data_transfer_layersmapping_add_item(), blender::data_transfer_layersmapping_add_item(), blender::data_transfer_layersmapping_add_item_cd(), LinearQuadPatch::eval(), film_apply_pass_pixel_overlays_rgba(), builtin::nodelink::frag(), eevee::geom_curves(), eevee::geom_gsplat(), eevee::geom_mesh(), eevee::geom_pointcloud(), eevee::geom_volume(), eevee::geom_world(), SkyTextureNode::get_sun_average_radiance(), blender::io::usd::import_mesh_skel_bindings(), eevee::init_globals(), eevee::init_globals_curves(), eevee::init_globals_mesh(), eevee::init_interface(), interp(), interp(), interp(), interp(), CCL_NAMESPACE_BEGIN::kernel_image_interp_3d(), SubPatch::map_uv(), blender::meshcache_read_mdd_range(), blender::meshcache_read_pc2_range(), blender::MOD_meshcache_calc_range(), blender::MOD_meshcache_read_mdd_frame(), blender::MOD_meshcache_read_mdd_times(), blender::MOD_meshcache_read_pc2_frame(), blender::MOD_meshcache_read_pc2_times(), blender::draw::particle_key_weight(), blender::project_paint_PickColor(), eevee::fast_gi::resolve(), UtilityTexture::sample_bsdf_lut(), blender::ed::sculpt_paint::sample_texture_paint_color(), SubdAttributeInterpolation::setup_attribute_corner_linear(), SubdAttributeInterpolation::setup_attribute_vertex_linear(), SKY_arhosekskymodel_radiance(), eevee::surf_capture(), eevee::surf_deferred(), eevee::surf_depth(), eevee::surf_forward(), eevee::surf_hybrid(), eevee::surf_occupancy(), eevee::surf_shadow(), eevee::surf_volume(), eevee::surf_world(), svm_math_wavelength_color_xyz(), svm_mix_color(), svm_mix_dark(), svm_mix_diff(), svm_mix_exclusion(), svm_mix_hue(), svm_mix_light(), eevee::shadow::usage::tag_usage_frag(), blender::gpu::to_string(), blender::to_string(), and builtin::nodelink::vert().

◆ intervals_intersection()

template<typename T>
ccl_device_inline Interval< T > intervals_intersection ( const ccl_private Interval< T > & first,
const ccl_private Interval< T > & second )

◆ inverse_lerp()

◆ inversesqrtf()

◆ is_zero()

ccl_device_inline bool is_zero ( const float a)

Definition at line 728 of file math_base.h.

References ccl_device_inline, and is_zero().

◆ isfinite_safe()

◆ isnan_safe()

ccl_device_inline bool isnan_safe ( const float f)

◆ make_zero() [1/2]

Definition at line 232 of file math_base.h.

References ccl_device_template_spec, and make_zero().

◆ make_zero() [2/2]

◆ max() [1/6]

ccl_device_inline double max ( const double a,
const double b )

Definition at line 193 of file math_base.h.

References b, ccl_device_inline, and max.

◆ max() [2/6]

ccl_device_inline float max ( const float a,
const float b )

Definition at line 183 of file math_base.h.

References b, ccl_device_inline, and max.

◆ max() [3/6]

ccl_device_inline int max ( const int a,
const int b )

Definition at line 134 of file math_base.h.

References b, ccl_device_inline, and max.

◆ max() [4/6]

ccl_device_inline uint32_t max ( const uint32_t a,
const uint32_t b )

Definition at line 144 of file math_base.h.

References b, ccl_device_inline, and max.

◆ max() [5/6]

ccl_device_inline uint64_t max ( const uint64_t a,
const uint64_t b )

Definition at line 154 of file math_base.h.

References b, ccl_device_inline, and max.

◆ max() [6/6]

template<class T>
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > max ( T a,
T b )
constexpr

Definition at line 172 of file math_base.h.

References b, ccl_device_inline, max, and T.

◆ max4() [1/2]

ccl_device_inline float max4 ( const float a,
const float b,
float c,
const float d )

Definition at line 225 of file math_base.h.

References b, ccl_device_inline, max, and max4().

◆ max4() [2/2]

template<typename T>
ccl_device_inline T max4 ( const T & a,
const T & b,
const T & c,
const T & d )

◆ merge() [1/2]

template<typename T>
ccl_device_inline Extrema< T > merge ( const ccl_private Extrema< T > & a,
const ccl_private Extrema< T > & b )

Definition at line 987 of file math_base.h.

References b, ccl_device_inline, ccl_private, max, merge(), and min.

◆ merge() [2/2]

template<typename T>
ccl_device_inline Extrema< T > merge ( const ccl_private Extrema< T > & a,
const ccl_private T & v )

Definition at line 994 of file math_base.h.

References ccl_device_inline, ccl_private, max, merge(), min, and T.

◆ min() [1/6]

ccl_device_inline double min ( const double a,
const double b )

Definition at line 198 of file math_base.h.

References b, ccl_device_inline, and min.

◆ min() [2/6]

ccl_device_inline float min ( const float a,
const float b )

Definition at line 188 of file math_base.h.

References b, ccl_device_inline, and min.

◆ min() [3/6]

ccl_device_inline int min ( const int a,
const int b )

Definition at line 139 of file math_base.h.

References b, ccl_device_inline, and min.

◆ min() [4/6]

ccl_device_inline uint32_t min ( const uint32_t a,
const uint32_t b )

Definition at line 149 of file math_base.h.

References b, ccl_device_inline, and min.

◆ min() [5/6]

ccl_device_inline uint64_t min ( const uint64_t a,
const uint64_t b )

Definition at line 159 of file math_base.h.

References b, ccl_device_inline, and min.

◆ min() [6/6]

template<class T>
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > min ( T a,
T b )
constexpr

Definition at line 178 of file math_base.h.

References b, ccl_device_inline, min, and T.

◆ min4() [1/2]

ccl_device_inline float min4 ( const float a,
const float b,
float c,
const float d )

Definition at line 220 of file math_base.h.

References b, ccl_device_inline, min, and min4().

◆ min4() [2/2]

template<typename T>
ccl_device_inline T min4 ( const T & a,
const T & b,
const T & c,
const T & d )

◆ mix()

template<typename T1, typename T2>
ccl_device_inline T1 mix ( const T1 a,
const T1 b,
const T2 t )

Definition at line 417 of file math_base.h.

References b, ccl_device_inline, mix, T1, and T2.

◆ mod()

ccl_device_inline int mod ( const int x,
const int m )

Definition at line 544 of file math_base.h.

References ccl_device_inline, mod, and x.

◆ next_power_of_two()

◆ nonzerof()

ccl_device_inline float nonzerof ( const float f,
const float eps )

Definition at line 507 of file math_base.h.

References ccl_device_inline, eps, fabsf, nonzerof(), and signf().

Referenced by nonzerof().

◆ one_minus_cos()

◆ operator*()

◆ operator+()

template<typename T>
ccl_device_inline Extrema< T > operator+ ( const ccl_private Extrema< T > & a,
const ccl_private Extrema< T > & b )

Definition at line 973 of file math_base.h.

References b, ccl_device_inline, ccl_private, and operator+().

◆ operator+=()

◆ operator/=()

template<typename T1, typename T2>
ccl_device_inline Interval< T1 > operator/= ( ccl_private Interval< T1 > & interval,
const T2 f )

◆ or_mask()

ccl_device_inline float or_mask ( const float x,
const uint y )

Definition at line 718 of file math_base.h.

References __float_as_uint, __uint_as_float, ccl_device_inline, or_mask(), x, and y.

Referenced by or_mask(), and rgbe_to_rgb().

◆ pingpongf()

ccl_device_inline float pingpongf ( const float a,
const float b )

Definition at line 488 of file math_base.h.

References b, ccl_device_inline, fabsf, fractf, and pingpongf().

Referenced by pingpongf(), and svm_math().

◆ pointer_pack_to_uint_0()

template<typename T>
ccl_device_inline uint pointer_pack_to_uint_0 ( T * ptr)

◆ pointer_pack_to_uint_1()

template<typename T>
ccl_device_inline uint pointer_pack_to_uint_1 ( T * ptr)

◆ pointer_unpack_from_uint()

template<typename T>
ccl_device_inline T * pointer_unpack_from_uint ( const uint a,
const uint b )

◆ popcount() [1/2]

◆ popcount() [2/2]

ccl_device_inline uint popcount ( const uint64_t x)

Definition at line 738 of file math_base.h.

References ccl_device_inline, popcount(), and x.

◆ pow20()

ccl_device_inline float pow20 ( const float a)

Definition at line 684 of file math_base.h.

References ccl_device_inline, pow20(), and sqr.

Referenced by pow20().

◆ pow22()

ccl_device_inline float pow22 ( const float a)

Definition at line 689 of file math_base.h.

References ccl_device_inline, pow22(), and sqr.

Referenced by pow22().

◆ power_of_2()

ccl_device_inline int power_of_2 ( const int a)

Definition at line 679 of file math_base.h.

References ccl_device_inline, and power_of_2().

Referenced by power_of_2(), and rgb_to_rgbe().

◆ prev_power_of_two()

ccl_device_inline uint prev_power_of_two ( const uint x)

◆ reverse_integer_bits()

◆ safe_acosf()

◆ safe_asinf()

◆ safe_divide()

ccl_device float safe_divide ( const float a,
const float b )

Definition at line 627 of file math_base.h.

References b, ccl_device, and safe_divide().

◆ safe_floored_modulo()

ccl_device float safe_floored_modulo ( const float a,
const float b )

Definition at line 646 of file math_base.h.

References b, ccl_device, floorf, and safe_floored_modulo().

◆ safe_logf()

ccl_device float safe_logf ( const float a,
const float b )

Definition at line 632 of file math_base.h.

References b, ccl_device, logf, safe_divide(), safe_logf(), and UNLIKELY.

Referenced by safe_logf(), and svm_math().

◆ safe_modulo()

ccl_device float safe_modulo ( const float a,
const float b )

Definition at line 641 of file math_base.h.

References b, ccl_device, fmodf, and safe_modulo().

◆ safe_powf()

ccl_device float safe_powf ( const float a,
const float b )

Definition at line 618 of file math_base.h.

References b, ccl_device, compatible_powf(), float_to_int(), safe_powf(), and UNLIKELY.

Referenced by safe_pow(), safe_powf(), and svm_math().

◆ safe_sqrtf()

◆ saturatef()

ccl_device_inline float saturatef ( const float a)

Definition at line 433 of file math_base.h.

References ccl_device_inline, clamp(), and saturatef.

◆ signf()

◆ sin_from_cos()

ccl_device_inline float sin_from_cos ( const float c)

Definition at line 656 of file math_base.h.

References ccl_device_inline, safe_sqrtf(), sin_from_cos(), and sqr.

◆ sin_sqr_to_one_minus_cos()

◆ smoothminf()

ccl_device_inline float smoothminf ( const float a,
const float b,
float k )

Definition at line 493 of file math_base.h.

References b, ccl_device_inline, fabsf, fmaxf, fminf, and smoothminf().

Referenced by smoothminf(), and svm_math().

◆ smoothstep()

ccl_device_inline float smoothstep ( const float edge0,
const float edge1,
const float x )

Definition at line 390 of file math_base.h.

References ccl_device_inline, smoothstep(), and x.

◆ smoothstepf()

ccl_device_inline float smoothstepf ( const float f)

◆ solve_quadratic()

ccl_device_inline bool solve_quadratic ( const float a,
const float b,
const float c,
ccl_private float & x1,
ccl_private float & x2 )

◆ sqr()

ccl_device_inline float sqr ( const float a)

Definition at line 651 of file math_base.h.

References ccl_device_inline, and sqr.

◆ uint16_pack_to_uint()

ccl_device_inline uint uint16_pack_to_uint ( const uint a,
const uint b )

Definition at line 340 of file math_base.h.

References b, ccl_device_inline, and uint16_pack_to_uint().

Referenced by uint16_pack_to_uint().

◆ uint16_unpack_from_uint_0()

ccl_device_inline uint uint16_unpack_from_uint_0 ( const uint i)

Definition at line 345 of file math_base.h.

References ccl_device_inline, and uint16_unpack_from_uint_0().

Referenced by uint16_unpack_from_uint_0().

◆ uint16_unpack_from_uint_1()

ccl_device_inline uint uint16_unpack_from_uint_1 ( const uint i)

Definition at line 350 of file math_base.h.

References ccl_device_inline, and uint16_unpack_from_uint_1().

Referenced by uint16_unpack_from_uint_1().

◆ wrapf()

ccl_device_inline float wrapf ( const float value,
const float max,
const float min )

Definition at line 482 of file math_base.h.

References ccl_device_inline, floorf, max, min, and wrapf().

Referenced by svm_math(), and wrapf().

◆ xor_mask()

ccl_device_inline float xor_mask ( const float x,
const uint y )

Definition at line 713 of file math_base.h.

References __float_as_uint, __uint_as_float, ccl_device_inline, x, xor_mask(), and y.

Referenced by xor_mask().