Blender V5.0
math_base_inline.cc File Reference
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "BLI_assert.h"
#include "BLI_math_inline.h"
#include "BLI_sys_types.h"

Go to the source code of this file.

Macros

#define __MATH_BASE_INLINE_C__
#define UNLIKELY(x)
#define _round_clamp_fl_impl(arg, ty, min, max)
#define _round_clamp_db_impl(arg, ty, min, max)
#define _round_fl_impl(arg, ty)
#define _round_db_impl(arg, ty)
#define unit_float_to_uchar_clamp_v3(v1, v2)
#define unit_float_to_uchar_clamp_v4(v1, v2)

Functions

MINLINE float pow2f (float x)
MINLINE float pow3f (float x)
MINLINE float pow4f (float x)
MINLINE float pow5f (float x)
MINLINE float pow7f (float x)
MINLINE float sqrt3f (float f)
MINLINE double sqrt3d (double d)
MINLINE float sqrtf_signed (float f)
MINLINE float interpf (float target, float origin, float fac)
MINLINE double interpd (double target, double origin, double fac)
MINLINE float ratiof (float min, float max, float pos)
MINLINE double ratiod (double min, double max, double pos)
MINLINE float power_of_2 (float val)
MINLINE int is_power_of_2_i (int n)
MINLINE int power_of_2_max_i (int n)
MINLINE int power_of_2_min_i (int n)
MINLINE unsigned int power_of_2_max_u (unsigned int x)
MINLINE unsigned int log2_floor_u (unsigned int x)
MINLINE unsigned int log2_ceil_u (unsigned int x)
MINLINE unsigned char round_fl_to_uchar (float a)
MINLINE short round_fl_to_short (float a)
MINLINE int round_fl_to_int (float a)
MINLINE unsigned int round_fl_to_uint (float a)
MINLINE int round_db_to_int (double a)
MINLINE unsigned char round_fl_to_uchar_clamp (float a)
MINLINE int round_fl_to_int_clamp (float a)
MINLINE unsigned char round_db_to_uchar_clamp (double a)
MINLINE short round_db_to_short_clamp (double a)
MINLINE int round_db_to_int_clamp (double a)
MINLINE float round_to_even (float f)
MINLINE int divide_round_i (int a, int b)
MINLINE int divide_floor_i (int a, int b)
MINLINE uint divide_ceil_u (uint a, uint b)
MINLINE uint64_t divide_ceil_ul (uint64_t a, uint64_t b)
MINLINE uint ceil_to_multiple_u (uint a, uint b)
MINLINE uint64_t ceil_to_multiple_ul (uint64_t a, uint64_t b)
MINLINE int mod_i (int i, int n)
MINLINE float floored_fmod (const float f, const float n)
MINLINE float fractf (float a)
MINLINE float wrapf (float value, float max, float min)
MINLINE float pingpongf (float value, float scale)
MINLINE int square_s (short a)
MINLINE int square_i (int a)
MINLINE unsigned int square_uint (unsigned int a)
MINLINE float square_f (float a)
MINLINE int cube_i (int a)
MINLINE float cube_f (float a)
MINLINE float min_ff (float a, float b)
MINLINE float max_ff (float a, float b)
MINLINE float smoothminf (float a, float b, float c)
MINLINE float smoothstep (float edge0, float edge1, float x)
MINLINE double min_dd (double a, double b)
MINLINE double max_dd (double a, double b)
MINLINE int min_ii (int a, int b)
MINLINE int max_ii (int a, int b)
MINLINE uint min_uu (uint a, uint b)
MINLINE uint max_uu (uint a, uint b)
MINLINE unsigned long long min_ulul (unsigned long long a, unsigned long long b)
MINLINE unsigned long long max_ulul (unsigned long long a, unsigned long long b)
MINLINE double max_ddd (double a, double b, double c)
MINLINE float min_fff (float a, float b, float c)
MINLINE float max_fff (float a, float b, float c)
MINLINE int min_iii (int a, int b, int c)
MINLINE int max_iii (int a, int b, int c)
MINLINE float min_ffff (float a, float b, float c, float d)
MINLINE float max_ffff (float a, float b, float c, float d)
MINLINE int min_iiii (int a, int b, int c, int d)
MINLINE int max_iiii (int a, int b, int c, int d)
MINLINE size_t min_zz (size_t a, size_t b)
MINLINE size_t max_zz (size_t a, size_t b)
MINLINE int clamp_i (int value, int min, int max)
MINLINE float clamp_f (float value, float min, float max)
MINLINE int compare_ff (float a, float b, const float max_diff)
MINLINE uint ulp_diff_ff (float a, float b)
MINLINE int compare_ff_relative (float a, float b, const float max_diff, const int max_ulps)
MINLINE bool compare_threshold_relative (const float value1, const float value2, const float thresh)
MINLINE float increment_ulp (const float value)
MINLINE float decrement_ulp (const float value)
MINLINE float signf (float f)
MINLINE float compatible_signf (float f)
MINLINE int signum_i_ex (float a, float eps)
MINLINE int signum_i (float a)
MINLINE int integer_digits_f (const float f)
MINLINE int integer_digits_d (const double d)
MINLINE int integer_digits_i (const int i)
MINLINE unsigned char unit_float_to_uchar_clamp (float val)
MINLINE unsigned short unit_float_to_ushort_clamp (float val)
MINLINE unsigned char unit_ushort_to_uchar (unsigned short val)

Macro Definition Documentation

◆ __MATH_BASE_INLINE_C__

#define __MATH_BASE_INLINE_C__

Definition at line 10 of file math_base_inline.cc.

◆ _round_clamp_db_impl

#define _round_clamp_db_impl ( arg,
ty,
min,
max )
Value:
{ \
double r = floor(arg + 0.5); \
if (UNLIKELY(r <= (double)min)) { \
return (ty)min; \
} \
if (UNLIKELY(r >= (double)max)) { \
return (ty)max; \
} \
return (ty)r; \
}
#define UNLIKELY(x)
#define floor
#define min(a, b)
Definition sort.cc:36
max
Definition text_draw.cc:251

Definition at line 169 of file math_base_inline.cc.

Referenced by round_db_to_int_clamp(), round_db_to_short_clamp(), and round_db_to_uchar_clamp().

◆ _round_clamp_fl_impl

#define _round_clamp_fl_impl ( arg,
ty,
min,
max )
Value:
{ \
float r = floorf(arg + 0.5f); \
if (UNLIKELY(r <= (float)min)) { \
return (ty)min; \
} \
if (UNLIKELY(r >= (float)max)) { \
return (ty)max; \
} \
return (ty)r; \
}
#define floorf

Definition at line 157 of file math_base_inline.cc.

Referenced by round_fl_to_int_clamp(), and round_fl_to_uchar_clamp().

◆ _round_db_impl

#define _round_db_impl ( arg,
ty )
Value:
{ \
return (ty)floor(arg + 0.5); \
}

Definition at line 185 of file math_base_inline.cc.

Referenced by round_db_to_int().

◆ _round_fl_impl

#define _round_fl_impl ( arg,
ty )
Value:
{ \
return (ty)floorf(arg + 0.5f); \
}

Definition at line 181 of file math_base_inline.cc.

Referenced by round_fl_to_int(), round_fl_to_short(), round_fl_to_uchar(), and round_fl_to_uint().

◆ unit_float_to_uchar_clamp_v3

#define unit_float_to_uchar_clamp_v3 ( v1,
v2 )
Value:
{ \
(v1)[0] = unit_float_to_uchar_clamp((v2[0])); \
(v1)[1] = unit_float_to_uchar_clamp((v2[1])); \
(v1)[2] = unit_float_to_uchar_clamp((v2[2])); \
} \
((void)0)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
MINLINE unsigned char unit_float_to_uchar_clamp(float val)

Definition at line 637 of file math_base_inline.cc.

Referenced by do_projectpaint_draw(), do_projectpaint_thread(), linearrgb_to_srgb_uchar3(), rgb_float_to_uchar(), and UI_GetThemeColorBlendShade3ubv().

◆ unit_float_to_uchar_clamp_v4

#define unit_float_to_uchar_clamp_v4 ( v1,
v2 )
Value:
{ \
(v1)[0] = unit_float_to_uchar_clamp((v2[0])); \
(v1)[1] = unit_float_to_uchar_clamp((v2[1])); \
(v1)[2] = unit_float_to_uchar_clamp((v2[2])); \
(v1)[3] = unit_float_to_uchar_clamp((v2[3])); \
} \
((void)0)

Definition at line 644 of file math_base_inline.cc.

Referenced by blender::ed::object::convert_float_color_to_byte_color(), IMB_rectfill(), linearrgb_to_srgb_uchar4(), and rgba_float_to_uchar().

◆ UNLIKELY

#define UNLIKELY ( x)
Value:

Definition at line 26 of file math_base_inline.cc.

Referenced by sqrt3d(), and sqrt3f().

Function Documentation

◆ ceil_to_multiple_u()

◆ ceil_to_multiple_ul()

◆ clamp_f()

MINLINE float clamp_f ( float value,
float min,
float max )

Definition at line 445 of file math_base_inline.cc.

◆ clamp_i()

MINLINE int clamp_i ( int value,
int min,
int max )

Definition at line 440 of file math_base_inline.cc.

◆ compare_ff()

◆ compare_ff_relative()

MINLINE int compare_ff_relative ( float a,
float b,
float max_diff,
int max_ulps )

Almost-equal for IEEE floats, using their integer representation (mixing ULP and absolute difference methods).

Parameters
max_diffis the maximum absolute difference (allows to take care of the near-zero area, where relative difference methods cannot really work).
max_ulpsis the 'maximum number of floats + 1' allowed between a and b to consider them equal.
See also
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Definition at line 492 of file math_base_inline.cc.

References b, BLI_assert, fabsf, MINLINE, and ulp_diff_ff().

Referenced by blender::ed::object::apply_objects_internal(), BKE_bezier_array_merge(), compare_v2_classify(), fcurve_is_changed(), blender::geometry::is_larger(), mesh_calc_eigen_matrix(), blender::animrig::new_key_needed(), blender::tests::TEST(), blender::tests::TEST(), and vfont_to_curve().

◆ compare_threshold_relative()

MINLINE bool compare_threshold_relative ( const float value1,
const float value2,
const float thresh )

Definition at line 503 of file math_base_inline.cc.

References fabsf, and MINLINE.

Referenced by blender::bke::compare_geometry::values_different().

◆ compatible_signf()

MINLINE float compatible_signf ( float f)

◆ cube_f()

MINLINE float cube_f ( float a)

Definition at line 313 of file math_base_inline.cc.

References MINLINE.

Referenced by ui_numedit_begin(), ui_numedit_but_SLI(), and widget_numslider().

◆ cube_i()

MINLINE int cube_i ( int a)

Definition at line 308 of file math_base_inline.cc.

References MINLINE.

Referenced by BKE_lightprobe_grid_cache_frame_sample_count().

◆ decrement_ulp()

MINLINE float decrement_ulp ( float value)

Decrement the given float to the next representable floating point value in the negative direction.

Infinities and NaNs are left untouched. Subnormal numbers are handled correctly, as is zero (i.e. 0 and -0 are considered a single value, and progressing past zero continues on to the negative numbers).

Definition at line 540 of file math_base_inline.cc.

References i, MINLINE, and v.

◆ divide_ceil_u()

◆ divide_ceil_ul()

◆ divide_floor_i()

MINLINE int divide_floor_i ( int a,
int b )

Integer division that floors negative result.

Note
This works like Python's int division.

Definition at line 227 of file math_base_inline.cc.

References b, and MINLINE.

Referenced by blender::nodes::node_fn_integer_math_cc::get_multi_function().

◆ divide_round_i()

MINLINE int divide_round_i ( int a,
int b )

Integer division that rounds 0.5 up, particularly useful for color blending with integers, to avoid gradual darkening when rounding down.

Definition at line 218 of file math_base_inline.cc.

References b, and MINLINE.

Referenced by blend_color_add_alpha_byte(), blend_color_add_byte(), blend_color_darken_byte(), blend_color_erase_alpha_byte(), blend_color_interpolate_byte(), blend_color_lighten_byte(), blend_color_mix_byte(), blend_color_mul_byte(), blend_color_sub_byte(), blender::color::ByteTraits::divide_round(), and IMB_rectblend().

◆ floored_fmod()

MINLINE float floored_fmod ( float f,
float n )

Floored modulo that is useful for wrapping numbers over n, including when f is negative.

This is the same as Python % or GLSL mod(): floored_fmod(-0.2, 1.0) = 0.8.

Returns
a float in the interval [0, n), same sign as n.

Definition at line 259 of file math_base_inline.cc.

References floorf, and MINLINE.

Referenced by blender::math::bilinear_fl_impl(), blender::math::interpolate_bilinear_wrap_byte(), blender::math::interpolate_nearest_wrap_byte(), blender::math::interpolate_nearest_wrap_fl(), blender::tests::TEST(), time_offset_fcurve_segment(), and blender::math::wrap_coord().

◆ fractf()

MINLINE float fractf ( float a)

Definition at line 264 of file math_base_inline.cc.

References floorf, and MINLINE.

◆ increment_ulp()

MINLINE float increment_ulp ( float value)

Increment the given float to the next representable floating point value in the positive direction.

Infinities and NaNs are left untouched. Subnormal numbers are handled correctly, as is crossing zero (i.e. 0 and -0 are considered a single value, and progressing past zero continues on to the positive numbers).

Definition at line 515 of file math_base_inline.cc.

References i, MINLINE, and v.

◆ integer_digits_d()

MINLINE int integer_digits_d ( double d)

Returns number of (base ten) significant digits of integer part of given double (negative in case of decimal-only floats, 0.01 returns -1 e.g.).

Definition at line 608 of file math_base_inline.cc.

References fabs(), floor, and MINLINE.

Referenced by unit_as_string(), and unit_as_string_split_pair().

◆ integer_digits_f()

MINLINE int integer_digits_f ( float f)

Returns number of (base ten) significant digits of integer part of given float (negative in case of decimal-only floats, 0.01 returns -1 e.g.).

Definition at line 603 of file math_base_inline.cc.

References fabs(), floor, and MINLINE.

Referenced by ui_but_string_get_ex().

◆ integer_digits_i()

MINLINE int integer_digits_i ( const int i)

◆ interpd()

◆ interpf()

MINLINE float interpf ( float target,
float origin,
float fac )

◆ is_power_of_2_i()

◆ log2_ceil_u()

◆ log2_floor_u()

MINLINE unsigned int log2_floor_u ( unsigned int x)

Definition at line 142 of file math_base_inline.cc.

References log2_floor_u(), MINLINE, and x.

Referenced by log2_ceil_u(), log2_floor_u(), and blender::tests::TEST().

◆ max_dd()

MINLINE double max_dd ( double a,
double b )

Definition at line 358 of file math_base_inline.cc.

References b, and MINLINE.

Referenced by max_ddd(), and blender::geometry::p_triangle_angles().

◆ max_ddd()

MINLINE double max_ddd ( double a,
double b,
double c )

Definition at line 390 of file math_base_inline.cc.

References b, max_dd(), and MINLINE.

Referenced by blender::geometry::p_chart_lscm_solve().

◆ max_ff()

MINLINE float max_ff ( float a,
float b )

Definition at line 324 of file math_base_inline.cc.

References b, and MINLINE.

Referenced by alpha_circle_mask(), annotation_draw_stroke_2d(), annotation_draw_stroke_3d(), annotation_draw_stroke_buffer(), blender::seq::SubEffectOp::apply(), blender::seq::WhiteBalanceApplyOp::apply(), barycentric_weights_v2_clamped(), blender::eevee::LightModule::begin_sync(), bezier_clamp(), bezier_handle_calc_smooth_fcurve(), BKE_bmbvh_overlap(), BKE_curvemapping_changed(), BKE_curvemapping_compute_range_dividers(), BKE_curvemapping_set_black_white_ex(), BKE_curvemapping_set_defaults(), BKE_curveprofile_move_point(), BKE_defvert_normalize_ex(), BKE_fcurves_calc_keyed_frames_ex(), BKE_gpencil_stroke_delete_tagged_points(), BKE_mask_spline_feather_resolution(), BKE_maskrasterize_handle_sample(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_tracking_marker_clamp_search_size(), blend_color_burn_float(), blend_color_erase_alpha_float(), blend_color_lighten_float(), blend_color_linearburn_float(), blend_color_linearlight_float(), blend_color_pinlight_float(), blend_color_screen_float(), blend_color_sub_float(), blend_color_vividlight_float(), blf_glyph_to_curves(), BLI_box_pack_2d(), BLI_bvhtree_new(), blinn_specular(), blo_do_versions_300(), blo_do_versions_400(), block_align_proximity_compute(), blender::seq::brightcontrast_apply(), blender::ed::sculpt_paint::brush_dynamic_size_get(), brush_edit_apply(), button2d_geom_draw_backdrop(), calc_bbox(), calc_bevfac_mapping(), blender::ed::sculpt_paint::expand::calc_new_mask_mesh(), blender::ed::transform::calc_tw_center(), calculate_autoscale_factor(), calculate_bezt_bounds_y(), calculate_collision_balls(), calculate_fpt_bounds(), ccd_mesh_make(), ccd_mesh_update(), clamp_nonzero(), blender::ed::transform::clipUVData(), cloth_collision_response_static(), cloth_record_result(), cloth_selfcollision_response_static(), compute_bbone_segment_boundaries(), computeBindWeights(), blender::gpu::convert(), curvemap_make_table(), cylinder_project_exec(), damptrack_do_transform(), dist_signed_squared_to_corner_v3v3v3(), do_versions_sequencer_speed_effect_recursive(), do_vert_pair(), draw_fcurve_curve(), draw_horizontal_scale_indicators(), blender::ed::vse::draw_seq_fcurve_overlay(), blender::ed::vse::draw_seq_text_overlay(), blender::ed::vse::draw_seq_waveform_overlay(), blender::ed::vse::draw_strip_icons(), blender::ed::transform::drawLine(), blender::ed::vse::drawmeta_contents(), drw_shgroup_bone_envelope(), dynamic_paint_effect_shrink_cb(), dynamic_paint_paint_particle_cell_point_cb_ex(), dynamic_paint_paint_single_point_cb_ex(), dynamicPaint_mixPaintColors(), ED_mask_draw_region(), ED_view3d_polygon_offset(), edbm_bevel_init(), edbm_bevel_modal(), edbm_inset_init(), edbm_inset_modal(), EDBM_preselect_edgering_draw(), expand_key_bounds(), fcurve_scene_coord_range_get(), find_last_key(), get_display_buffer_processor(), blender::animrig::get_frame_range_of_fcurves(), get_keyframe_extents(), blender::seq::give_frame_index(), blender::ed::transform::gizmo2d_xform_draw_prepare(), gizmo_bbone_offset_set(), GPU_line_width(), blender::nodes::node_shader_color_ramp_cc::gpu_shader_valtorgb(), gpu_texture_create_tile_array(), heat_set_H(), IDP_EqualsProperties_ex(), IMB_colormanagement_setup_glsl_draw_from_space(), blender::eevee::AmbientOcclusion::init(), blender::workbench::CavityEffect::init(), interp_weights_poly_v2(), interp_weights_poly_v3(), isect_seg_seg_v2_point_ex(), blender::ed::vse::label_rect_get(), blender::ed::vse::label_rect_init(), layer_bucket_init(), blender::bke::greasepencil::convert::legacy_gpencil_frame_to_grease_pencil_drawing(), blender::bke::pbvh::long_edge_queue_edge_add_recursive(), loopcut_modal(), make_box_union(), blender::color::FloatTraits::max(), max_fff(), max_ffff(), max_v3_v3v3(), meshdeform_ray_tree_intersect(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), move_segment(), blender::ed::transform::nearest_world_tree(), blender::ed::space_node::nodelink_get_draw_config(), blender::ed::object::object_rand_transverts(), blender::draw::overlay::Lights::object_sync(), blender::ed::object::object_warp_transverts_minmax_x(), offset_meet(), blender::eevee::Film::overscan_pixels_get(), blender::geometry::pack_islands_alpaca_rotate(), blender::geometry::pack_islands_alpaca_turbo(), blender::geometry::pack_islands_optimal_pack(), blender::ed::sculpt_paint::paint_cursor_context_init(), blender::ed::sculpt_paint::paint_space_stroke_spacing(), blender::ed::sculpt_paint::paint_stroke_overlapped_curve(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_update_step(), polyedge_beauty_cost_update_single(), blender::draw::View::OffsetData::polygon_offset_factor(), py_bvhtree_overlap(), quad_calc_error(), radial_control_invoke(), ramp_blend(), RE_GetWindowMatrixWithOverscan(), blender::io::usd::USDCameraReader::read_object_data(), blender::io::alembic::AbcCameraReader::readObjectData(), recalc_face_normals_find_index(), blender::eevee::DepthOfField::render(), blender::seq::retiming_transition_key_frame_set(), rgb_to_cpack(), RNA_property_float_ui_range(), safe_sqrtf(), blender::gpu::MTLContext::sampler_state_cache_init(), scan_for_ext_face_forces(), blender::ed::sculpt_paint::expand::sculpt_expand_modal(), blender::ed::sculpt_paint::sculpt_update_cache_invariants(), blender::ed::vse::sequencer_main_clamp_view(), blender::ed::vse::sequencer_retiming_draw_continuity(), SimpleDeformModifier_do(), slider_update_factor(), smart_uv_project_calculate_project_normals(), smooth_view_rect_to_fac(), smoothminf(), snap_to_superellipsoid(), softbody_apply_forces(), softbody_step(), sphclassical_calc_dens(), sphere_project_exec(), splineik_evaluate_bone(), square_roughness_node_insert(), blender::draw::statvis_calc_distort(), blender::draw::statvis_calc_sharp(), stitch_island_calculate_edge_rotation(), stitch_island_calculate_vert_rotation(), stretchto_evaluate(), blender::ed::vse::strip_draw_context_get(), svd_m4(), blender::eevee::DepthOfField::sync(), blender::gpu::tests::texture_create_upload_read_with_bias(), texture_value_blend(), tracking_check_marker_margin(), blender::ed::transform::transformEvent(), ui_block_bounds_calc(), ui_block_bounds_calc_text(), ui_but_range_set_soft(), ui_do_but_NUM(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), ui_draw_dropshadow(), ui_menu_scroll_apply_offset_y(), ui_numedit_begin(), ui_numedit_but_NUM(), ui_popup_block_position(), ui_popup_block_refresh(), ui_tooltip_create_with_data(), blender::ed::sculpt_paint::update_curve_mask(), blender::ed::sculpt_paint::expand::update_mask_bmesh(), blender::ed::sculpt_paint::expand::update_mask_grids(), blender::draw::overlay::Resources::update_theme_settings(), blender::bke::pbvh::uv_islands::UVBorderCorner::uv(), uv_cylinder_project(), uv_map_mirror(), uv_sphere_project(), v3d_cursor_plane_draw(), vertex_color_brightness_contrast_exec(), blender::draw::overlay::Resources::vertex_size_get(), vertex_sort(), vfont_to_curve(), blender::ed::object::vgroup_normalize(), view3d_orbit_apply_dyn_ofs_ortho_correction(), view3d_zoom_border_exec(), blender::ed::space_node::viewer_border_exec(), viewzoom_scale_value(), blender::ed::object::voxel_size_edit_invoke(), blender::ed::object::voxel_size_edit_modal(), walkEvent(), widget_scroll(), WIDGETGROUP_empty_image_refresh(), blender::draw::View::OffsetData::winmat_polygon_offset(), wm_software_cursor_draw_crosshair(), WM_window_dpi_set_userdef(), wm_xr_navigation_teleport(), wrapped_lighting(), and zspan_scanconvert().

◆ max_fff()

◆ max_ffff()

◆ max_ii()

MINLINE int max_ii ( int a,
int b )

Definition at line 367 of file math_base_inline.cc.

References b, and MINLINE.

Referenced by accessor_get_ibuf(), blender::eevee::GBuffer::acquire(), action_space_icon_get(), action_space_name_get(), actionzone_modal(), blender::gpu::MTLFrameBuffer::add_color_attachment(), blender::gpu::MTLFrameBuffer::add_depth_attachment(), blender::gpu::MTLShaderInterface::add_input_attribute(), blender::gpu::MTLFrameBuffer::add_stencil_attachment(), blender::gpu::MTLShaderInterface::add_storage_block(), blender::gpu::MTLShaderInterface::add_texture(), blender::gpu::MTLShaderInterface::add_uniform_block(), blender::bke::pbvh::uv_islands::add_uv_island(), animviz_calc_motionpaths(), annotation_draw_eraser(), blender::seq::SubEffectOp::apply(), area_move_set_limits(), azone_clipped_rect_calc(), blender::gpu::MTLShader::bake_pipeline_state(), bevel_build_cutoff(), blender::gpu::VKVertexAttributeObject::bind(), BKE_autotrack_context_sync(), BKE_curve_material_index_validate(), BKE_icon_geom_rasterize(), BKE_image_get_tile_info(), BKE_mask_get_duration(), BKE_mask_spline_resolution(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_validate_material_indices(), BKE_nurb_order_clamp_u(), BKE_nurb_order_clamp_v(), BKE_render_num_threads(), BKE_sculpt_mask_layers_ensure(), BKE_tracking_get_plane_imbuf(), BKE_tracking_reconstruction_context_new(), BKE_tracking_tracks_first_last_frame_minmax(), blend_color_burn_byte(), blend_color_erase_alpha_byte(), blend_color_lighten_byte(), blend_color_linearburn_byte(), blend_color_linearlight_byte(), blend_color_pinlight_byte(), blend_color_screen_byte(), blend_color_sub_byte(), blend_color_vividlight_byte(), blend_file_thumb_clamp_size(), BLI_bitmap_draw_2d_poly_v2i_n(), BLI_bvhtree_find_nearest_projected(), BLI_ghash_calc_quality_ex(), BLI_rcti_do_minmax_rcti(), blo_do_versions_410(), blo_do_versions_420(), bm_edgering_pair_subdiv(), BM_mesh_bevel(), BM_mesh_decimate_dissolve_ex(), BM_mesh_partial_create_from_verts_group_multi(), BM_mesh_partial_create_from_verts_group_single(), bmo_create_grid_exec(), bmo_unsubdivide_exec(), brush_scale_size_exec(), calculate_autoscale_factor(), blender::bke::pbvh::pixels::CopyPixelCommand::can_be_extended(), blender::gpu::VKBackend::capabilities_init(), change_spacing_exec(), channels_bake_exec(), circle_select_exec(), clamp_i(), clip_set_scene_frames_exec(), blender::eevee::DeferredPipeline::closure_layer_count(), cloth_record_result(), blender::gpu::VKFrameBuffer::color_attachments_resource_size(), colorband_init_from_table_rgba_simple(), blender::gpu::MTLContext::compute_dispatch(), blender::draw::View::compute_visibility(), console_select_to_buffer(), cp_cu_key(), blender::seq::create_missing_media_image(), create_primitive_from_points(), blender::ed::transform::create_trans_seq_clamp_data(), curve_decimate_exec(), curvemap_buttons_layout(), curvemap_make_table(), CurveProfile_buttons_layout(), blender::ed::vse::displayed_channel_range_get(), dopesheet_view_all_exec(), blender::workbench::DofPass::draw(), blender::ed::space_node::draw_background_color(), blender::ed::vse::draw_seq_fcurve_overlay(), blender::ed::vse::draw_seq_timeline_channels(), draw_spline_curve(), draw_text_main(), blender::ed::vse::drawmeta_contents(), blender::ed::object::drop_named_material_invoke(), blender::ed::object::drop_named_material_tooltip(), ED_curve_editfont_select_pick(), ED_info_draw_stats(), ed_preview_draw_rect(), ED_region_image_overlay_info_text_draw(), ED_scene_fps_average_accumulate(), ED_view3d_backbuf_sample_size_clamp(), ED_view3d_depth_read_cached(), ED_view3d_update_viewmat(), blender::gpu::MTLImmediate::end(), blender::eevee::LightModule::end_sync(), blender::gpu::MTLContext::ensure_render_pipeline_state(), uiLayoutItemFlow::estimate_impl(), uiLayoutItemGridFlow::estimate_impl(), fcurve_scene_coord_range_get(), file_smoothscroll_invoke(), filelist_file_cache_block(), blender::bke::pbvh::pixels::Rows::find_second_source(), blender::eevee::VelocityModule::geometry_steps_fill(), gesture_box_apply_rect(), get_active_fcurve_keyframe_edit(), blender::get_factor_from_index(), blender::ed::space_node::get_main_socket(), blender::gpu::VKQueryPool::get_occlusion_result(), blender::gpu::GLPixelBuffer::GLPixelBuffer(), blender::gpu::GLShaderInterface::GLShaderInterface(), GPU_offscreen_create(), gpu_texture_create_tile_array(), gpu_texture_update_from_ibuf(), blender::ed::sculpt_paint::grease_pencil_eraser_draw(), blender::eevee::DeferredPipeline::header_layer_count(), image_sample_apply(), image_view_all(), IMB_create_gpu_texture(), implicit_needed_branches(), blender::eevee::Film::init(), blender::eevee::MotionBlurModule::init(), blender::eevee::Sampling::init(), blender::eevee::Sampling::init(), blender::workbench::DofPass::init(), blender::workbench::SceneState::init(), blender::gpu::Texture::init_2D(), blender::gpu::Texture::init_cubemap(), blender::ed::object::lattice_add_to_selected_exec(), blender::ed::vse::left_fake_key_frame_get(), blender::bke::image::partial_update::PartialUpdateRegisterImpl::limit_history(), M_Geometry_interpolate_bezier(), blender::bke::image::partial_update::TileChangeset::mark_region(), blender::eevee::SphereProbeAtlasCoord::LocationFinder::mark_space_used(), blender::bke::pbvh::uv_islands::mask_resolution_from_tile_resolution(), blender::eevee::DeferredLayer::material_add(), blender::eevee::DeferredProbePipeline::material_add(), blender::eevee::PlanarProbePipeline::material_add(), Matrix_str(), blender::color::ByteTraits::max(), max_iii(), max_iiii(), blender::gpu::Texture::mip_depth_get(), blender::gpu::Texture::mip_height_get(), blender::gpu::Texture::mip_size_get(), blender::gpu::Texture::mip_width_get(), MOD_lineart_gpencil_generate_v3(), MOD_meshcache_calc_range(), motionpath_calculate_update_range(), motionpath_get_global_framerange(), blender::gpu::name_buffer_copystr(), blender::ed::space_node::node_socket_calculate_height(), blender::eevee::DeferredPipeline::normal_layer_count(), ZstdWriteWrap::open(), blender::ed::outliner::outliner_data_api_buttons_start_x(), panel_calculate_size_recursive(), panel_draw_aligned_backdrop(), paste_get_y_offset(), pipe_adj_vmesh(), blender::gpu::MSLGeneratorInterface::prepare_from_createinfo(), blender::ed::space_node::preview_prepare_scene(), preview_prepare_scene(), uiLayout::prop(), psys_get_pointcache_start_end(), psys_thread_context_init_path(), blender::gpu::VKPushConstants::push_constant_set(), pygpu_texture__tp_new(), radial_control_invoke(), blender::ed::sculpt_paint::face_set::randomize_colors_exec(), blender::eevee::IrradianceBake::raylists_build(), blender::gpu::MTLTexture::read(), blender::gpu::VKFrameBuffer::read(), blender::ed::vse::realize_fake_keys_in_rect(), region_rect_recursive(), blender::eevee::RayTraceModule::render(), blender::draw::gpencil::render_frame(), blender::seq::render_give_ibuf(), blender::gpu::VKFrameBuffer::rendering_ensure_dynamic_rendering(), LayoutAbsolute::resolve_impl(), LayoutRadial::resolve_impl(), RNA_property_int_ui_range(), blender::ed::sculpt_paint::expand::sculpt_expand_modal(), seq_update_meta_disp_range(), blender::ed::vse::seq_view_collection_rect_timeline(), blender::ed::vse::sequencer_add_effect_strip_exec(), blender::seq::sequencer_all_free_anim_ibufs(), blender::ed::vse::sequencer_drop_copy(), blender::ed::vse::sequencer_export_subtitles_exec(), blender::ed::vse::sequencer_image_strip_get_minmax_frame(), blender::ed::vse::sequencer_meta_make_exec(), blender::ed::vse::sequencer_select_side_exec(), blender::ed::vse::sequencer_set_range_to_strips_exec(), blender::ed::vse::sequencer_visible_strips_get(), set_profile_spacing(), blender::ed::object::shape_key_move_exec(), blender::seq::shuffle_strip_time_offset_get(), SIM_hair_volume_add_segment(), blender::seq::strip_time_effect_range_set(), blender::seq::strip_update_sound_bounds_recursive_impl(), svd_m4(), blender::eevee::RayTraceModule::sync(), blender::ed::asset::take_screenshot_crop(), blender::draw::TestDefrag::TestDefrag(), text_scroll_state_init(), textview_draw_sel(), blender::seq::time_update_meta_strip_range(), tracking_dopesheet_calc_coverage(), tracking_dopesheet_channels_segments_calc(), blender::seq::transform_seqbase_shuffle_ex(), blender::ed::transform::transform_snap_reset_from_mode(), ui_do_but_NUM(), ui_item_rna_size(), ui_litem_grid_flow_compute(), UI_panel_category_draw_all(), ui_panels_size(), ui_text_clip_cursor(), ui_text_clip_middle(), ui_text_clip_middle_protect_right(), ui_text_clip_right_label(), ui_tooltip_create_with_data(), uilist_prepare(), uiTemplateReportsBanner(), uiTemplateStatusInfo(), unit_as_string_split_pair(), blender::gpu::GLTexture::update_sub(), blender::gpu::MTLTexture::update_sub(), blender::gpu::VKTexture::update_sub(), vfont_to_curve(), view2d_masks(), widget_draw_text(), widget_scroll(), wm_main_playanim_intern(), WM_window_dpi_set_userdef(), and zspan_scanconvert().

◆ max_iii()

◆ max_iiii()

MINLINE int max_iiii ( int a,
int b,
int c,
int d )

Definition at line 426 of file math_base_inline.cc.

References b, max_ii(), max_iii(), and MINLINE.

Referenced by _bli_array_iter_spiral_square().

◆ max_ulul()

◆ max_uu()

◆ max_zz()

MINLINE size_t max_zz ( size_t a,
size_t b )

Definition at line 435 of file math_base_inline.cc.

References b, and MINLINE.

◆ min_dd()

MINLINE double min_dd ( double a,
double b )

Definition at line 354 of file math_base_inline.cc.

References b, and MINLINE.

◆ min_ff()

MINLINE float min_ff ( float a,
float b )

Definition at line 320 of file math_base_inline.cc.

References b, and MINLINE.

Referenced by alpha_circle_mask(), annotation_draw_apply(), area_draw_azone_fullscreen(), blender::ed::space_node::backimage_fit_exec(), bezier_clamp(), bezier_handle_calc_smooth_fcurve(), BKE_curvemapping_changed(), BKE_curvemapping_set_defaults(), BKE_curveprofile_move_point(), BKE_maskrasterize_handle_sample(), BKE_tracking_marker_clamp_search_size(), blend_color_add_alpha_float(), blend_color_darken_float(), blend_color_dodge_float(), blend_color_hardlight_float(), blend_color_linearlight_float(), blend_color_overlay_float(), blend_color_pinlight_float(), blend_color_vividlight_float(), blo_do_versions_270(), blo_do_versions_300(), blo_do_versions_400(), bm_decim_build_edge_cost_single__topology(), bm_decim_build_edge_cost_single_squared__topology(), bmo_create_uvsphere_exec(), bmo_dissolve_degenerate_exec(), bmo_dissolve_limit_exec(), boid_body(), btw_smooth_graph_keys(), butterworth_smooth_fcurve_segment(), button2d_geom_draw_backdrop(), calc_bevfac_mapping(), blender::ed::sculpt_paint::expand::calc_new_mask_mesh(), blender::ed::transform::calc_tw_center(), calctrackballvec(), calculate_autoscale_factor(), calculate_bezt_bounds_y(), calculate_collision_balls(), calculate_fpt_bounds(), ccd_mesh_make(), ccd_mesh_update(), blender::ed::vse::channel_draw_context_init(), clamp_nonzero(), clip_view_calculate_view_selection(), blender::ed::transform::clipUVData(), cloth_collision_response_static(), cloth_record_result(), cloth_selfcollision_response_static(), computeAngularWeight(), computeBindWeights(), convert_tree(), curvemap_make_table(), damptrack_do_transform(), dist_signed_squared_to_corner_v3v3v3(), do_projectpaint_thread(), draw_fcurve_curve(), draw_keylist_block_gpencil(), draw_marker_slide_zones(), blender::ed::vse::draw_seq_fcurve_overlay(), blender::ed::vse::draw_seq_text_overlay(), blender::ed::vse::draw_seq_waveform_overlay(), blender::ed::vse::draw_strip_icons(), blender::ed::vse::draw_strip_in_view(), blender::ed::vse::drawmeta_contents(), dynamic_paint_effect_drip_cb(), dynamic_paint_effect_spread_cb(), ED_view3d_backbuf_sample_size_clamp(), ED_view3d_update_viewmat(), blender::ed::transform::edge_slide_apply_elem(), expand_key_bounds(), fcurve_scene_coord_range_get(), find_next_key(), flyApply(), flyEvent(), geodesic_distance_propagate_across_triangle(), blender::animrig::get_frame_range_of_fcurves(), get_keyframe_extents(), blender::bke::pbvh::uv_islands::UVIslandsMask::Tile::get_pixel_size_in_uv_space(), blender::ed::vse::get_seq_strip_thumbnails(), get_shortest_pattern_side(), getArrowEndPoint(), gpu_texture_create_tile_array(), image_view_all(), IMB_rectblend(), immDrawBorderCorners(), blender::ed::sculpt_paint::expand::init_from_face_set_boundary(), blender::ed::vse::inner_clickable_handle_size_get(), isect_seg_seg_v2_point_ex(), knife_snap_size(), blender::ed::vse::label_rect_get(), layer_bucket_init(), line_rect_clip(), make_box_union(), merge_frame_corners(), blender::color::FloatTraits::min(), min_fff(), min_ffff(), mix_normals(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), modify_mesh(), move_segment(), nla_action_draw_keyframes(), blender::ed::space_node::node_insert_on_link_flags_set(), blender::ed::space_node::node_update_basis(), blender::ed::object::object_warp_transverts_minmax_x(), paint_calculate_rake_rotation(), pipe_adj_vmesh(), quad_calc_error(), radial_control_invoke(), ramp_blend(), blender::eevee::DepthOfField::render(), blender::ed::vse::retiming_fake_key_frame_clicked(), rgb_to_hsl(), rgb_to_hsv(), RNA_property_float_ui_range(), blender::gpu::GLTexture::samplers_update(), sb_detect_edge_collisionCached(), scan_for_ext_face_forces(), scanfill(), blender::ed::vse::seq_view_collection_rect_preview(), blender::ed::vse::sequencer_main_clamp_view(), blender::ed::vse::sequencer_retiming_draw_continuity(), blender::ed::vse::sequencer_view_all_preview_exec(), sima_zoom_set_from_bounds(), SimpleDeformModifier_do(), slider_update_factor(), smooth_view_rect_to_fac(), smoothminf(), snap_to_superellipsoid(), softbody_apply_forces(), softbody_step(), sphclassical_calc_dens(), spline_under_mouse_get(), splineik_evaluate_bone(), stitch_island_calculate_edge_rotation(), stitch_island_calculate_vert_rotation(), stretchto_evaluate(), blender::ed::vse::strip_draw_context_get(), blender::ed::vse::strip_handle_draw_size_get(), blender::ed::vse::strip_header_size_get(), texture_value_blend(), blender::geometry::Occupancy::trace_triangle(), blender::ed::transform::transformEvent(), ui_but_range_set_soft(), ui_do_animate(), ui_do_but_NUM(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), ui_draw_but_UNITVEC(), ui_draw_dropshadow(), ui_menu_scroll_apply_offset_y(), ui_numedit_begin(), ui_numedit_but_HISTOGRAM(), ui_numedit_but_HSVCIRCLE(), ui_numedit_set_active(), ui_popup_block_refresh(), UI_text_clip_middle_ex(), ui_update_flexible_spacing(), unified_findnearest(), blender::ed::sculpt_paint::expand::update_mask_bmesh(), blender::ed::sculpt_paint::expand::update_mask_grids(), uv_map_mirror(), uv_rip_single_from_loop(), versioning_eevee_material_blend_mode_settings(), vfont_to_curve(), view3d_center_camera_exec(), view3d_ruler_pick(), view_all_exec(), blender::ed::space_node::viewer_border_exec(), walkApply(), walkEvent(), WM_xr_session_state_vignette_activate(), WM_xr_session_state_vignette_update(), zbuf_add_to_span(), and zspan_scanconvert().

◆ min_fff()

◆ min_ffff()

◆ min_ii()

MINLINE int min_ii ( int a,
int b )

Definition at line 363 of file math_base_inline.cc.

References b, and MINLINE.

Referenced by accessor_get_ibuf(), add_bezt_vertices(), blender::bke::pbvh::uv_islands::add_uv_island(), animviz_calc_motionpaths(), blender::seq::AddEffectOp::apply(), area_move_set_limits(), azone_clipped_rect_calc(), BKE_autotrack_context_sync(), BKE_blendfile_userdef_from_defaults(), BKE_image_get_tile_info(), BKE_key_evaluate_object_ex(), BKE_keyblock_convert_to_curve(), BKE_keyblock_convert_to_lattice(), BKE_mask_spline_feather_collapse_inner_loops(), BKE_maskrasterize_handle_init(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_tracking_get_projection_matrix(), BKE_tracking_reconstruction_context_new(), BKE_tracking_tracks_first_last_frame_minmax(), blend_color_add_alpha_byte(), blend_color_add_byte(), blend_color_darken_byte(), blend_color_dodge_byte(), blend_color_exclusion_byte(), blend_color_hardlight_byte(), blend_color_linearlight_byte(), blend_color_overlay_byte(), blend_color_pinlight_byte(), blend_color_vividlight_byte(), BLI_bitmap_draw_2d_poly_v2i_n(), BLI_rcti_do_minmax_rcti(), blo_do_versions_280(), BM_mesh_bm_from_me(), blender::ed::transform::bm_mesh_edges_select_get_n(), BM_mesh_partial_create_from_verts(), BM_mesh_partial_create_from_verts_group_multi(), BM_mesh_partial_create_from_verts_group_single(), blender::ed::transform::bm_mesh_verts_select_get_n(), bmo_bisect_plane_exec(), brush_painter_imbuf_partial_update(), brush_painter_mask_imbuf_partial_update(), butterworth_smooth_fcurve_segment(), calcknots(), calculate_autoscale_factor(), blender::bke::curves::nurbs::calculate_knots(), channels_bake_exec(), clamp_i(), cloth_record_result(), color_clamp_index(), colorband_init_from_table_rgba_simple(), console_select_to_buffer(), cp_cu_key(), blender::ed::transform::create_trans_seq_clamp_data(), CurveProfile_buttons_layout(), blender::bke::pbvh::pixels::do_encode_pixels(), do_history(), dopesheet_view_all_exec(), draw_movieclip_cache(), draw_textscroll(), blender::ed::vse::drawmeta_contents(), ED_region_header_layout(), ED_region_info_draw_multiline(), ED_region_panels_layout_ex(), ED_view3d_depth_read_cached(), edbm_fill_grid_prepare(), blender::eevee::DeferredLayer::end_sync(), blender::eevee::LightModule::end_sync(), blender::gpu::MTLContext::ensure_render_pipeline_state(), LayoutAbsolute::estimate_impl(), uiLayoutItemFlow::estimate_impl(), uiLayoutItemGridFlow::estimate_impl(), euler_filter_perform_filter(), fcurve_scene_coord_range_get(), file_draw_list(), filelist_file_cache_block(), find_next_key(), blender::bke::pbvh::pixels::Rows::find_second_source(), gesture_box_apply_rect(), blender::gpu::VKQueryPool::get_occlusion_result(), get_render_subsurf_level(), GPU_texture_size_with_limit(), gpu_texture_update_from_ibuf(), image_sample_apply(), imb_loadiris(), blender::eevee::ShadowModule::init(), blender::workbench::CavityEffect::init(), blender::workbench::SceneState::init(), ViewportColorSampleSession::init(), blender::gpu::Texture::init_1D(), blender::gpu::Texture::init_2D(), blender::gpu::Texture::init_3D(), blender::bke::image::partial_update::TileChangeset::init_chunks(), blender::gpu::Texture::init_cubemap(), blender::gpu::Texture::init_view(), blender::bke::image::partial_update::TileChangeset::mark_region(), mathutils_matrix_col_get(), mathutils_matrix_col_set(), Matrix_to_NxN(), matrix_unit_internal(), blender::color::ByteTraits::min(), min_iii(), min_iiii(), MOD_meshcache_calc_range(), motionpath_calculate_update_range(), motionpath_get_global_framerange(), blender::seq::multiply_ibuf(), blender::ed::space_node::node_update_basis_socket(), non_recursive_bvh_div_nodes(), paste_get_y_offset(), prefetch_get_final_frame(), blender::gpu::present(), psys_get_pointcache_start_end(), psys_tasks_create(), blender::seq::query_right_side_strips(), radial_control_invoke(), read_bone_collections(), blender::gpu::VKTexture::read_sub(), blender::ed::vse::realize_fake_keys_in_rect(), blender::eevee::DepthOfField::render(), LayoutAbsolute::resolve_impl(), LayoutRadial::resolve_impl(), LayoutRow::resolve_impl(), uiLayoutItemFlow::resolve_impl(), uiLayoutItemGridFlow::resolve_impl(), blender::ed::vse::right_fake_key_frame_get(), RNA_property_int_ui_range(), round_box__edges(), blender::eevee::ShadowModule::screen_pixel_radius(), seq_update_meta_disp_range(), blender::ed::vse::seq_view_collection_rect_timeline(), blender::seq::sequencer_all_free_anim_ibufs(), blender::ed::vse::sequencer_image_strip_get_minmax_frame(), blender::ed::vse::sequencer_meta_make_exec(), blender::ed::vse::sequencer_select_side_exec(), blender::ed::vse::sequencer_set_range_to_strips_exec(), blender::ed::vse::sequencer_visible_strips_get(), blender::eevee::ShadowTileMapPool::ShadowTileMapPool(), blender::ed::object::shape_key_move_exec(), blender::seq::shuffle_strip_time_offset_get(), SIM_hair_volume_add_segment(), blender::seq::strip_time_effect_range_set(), blender::seq::strip_update_sound_bounds_recursive_impl(), svd_m4(), blender::ed::asset::take_screenshot_crop(), blender::draw::TestDefrag::TestDefrag(), textview_draw_sel(), tile_remove_exec(), blender::seq::time_update_meta_strip_range(), track_init_markers(), tracking_dopesheet_calc_coverage(), ui_block_func_POPUP(), ui_but_drag_init(), ui_do_but_NUM(), ui_draw_but_HSVCIRCLE(), ui_hsvcircle_pos_from_vals(), ui_hsvcircle_vals_from_pos(), ui_item_array(), ui_panels_size(), ui_searchbox_region_draw_cb__operator(), ui_tooltip_create_with_data(), uilist_prepare(), uiTemplateReportsBanner(), blender::ed::sculpt_paint::update_curve_mask(), blender::gpu::MTLBufferPool::update_memory_pools(), vfont_to_curve(), blender::gpu::MTLShader::warm_cache(), widget_numbut_draw(), WM_operator_properties_checker_interval(), wm_xr_session_action_test_bimanual(), and zspan_scanconvert().

◆ min_iii()

◆ min_iiii()

MINLINE int min_iiii ( int a,
int b,
int c,
int d )

Definition at line 422 of file math_base_inline.cc.

References b, min_ii(), min_iii(), and MINLINE.

Referenced by _bli_array_iter_spiral_square().

◆ min_ulul()

◆ min_uu()

◆ min_zz()

MINLINE size_t min_zz ( size_t a,
size_t b )

◆ mod_i()

◆ pingpongf()

MINLINE float pingpongf ( float value,
float scale )

Definition at line 276 of file math_base_inline.cc.

References fabsf, fractf, and MINLINE.

Referenced by svm_math(), blender::nodes::try_dispatch_float_math_fl_fl_to_fl(), and valuefn().

◆ pow2f()

MINLINE float pow2f ( float x)

Definition at line 29 of file math_base_inline.cc.

References MINLINE, and x.

Referenced by blender::ed::spreadsheet::apply_row_filter(), BKE_brush_gen_radial_control_imbuf(), BKE_curveprofile_update(), BKE_kelvinlet_grab_triscale(), blender::ed::sculpt_paint::cache_paint_invariants_update(), blender::ed::sculpt_paint::filter::calc_sharpen_detail_translations(), blender::ed::sculpt_paint::CombOperationExecutor::comb_projected(), blender::ed::sculpt_paint::CombOperationExecutor::comb_spherical(), blender::ed::sculpt_paint::DeleteOperationExecutor::delete_projected(), blender::ed::sculpt_paint::DeleteOperationExecutor::delete_spherical(), draw_start_vertex_circle(), ease_sigmoid_function(), blender::draw::edituv_get_edituv_stretch_angle(), blender::ed::curves::find_closest_curve_to_screen_co(), blender::ed::curves::find_closest_point_to_screen_co(), blender::ed::sculpt_paint::PuffOperationExecutor::find_curve_weights_projected(), blender::ed::sculpt_paint::find_curves_brush_position(), blender::ed::sculpt_paint::SlideOperationExecutor::find_curves_to_slide(), blender::ed::sculpt_paint::PuffOperationExecutor::find_curves_weights_spherical(), blender::ed::sculpt_paint::SmoothOperationExecutor::find_projected_smooth_factors(), blender::ed::sculpt_paint::SmoothOperationExecutor::find_spherical_smooth_factors(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_projected(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_spherical(), blender::eevee::Film::init(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_bmesh(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_grids(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_mesh(), init_kelvinlet_grab(), kelvinlet_scale(), kelvinlet_twist(), blender::ed::sculpt_paint::filter::mesh_filter_sharpen_init(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_curve_selection_projected(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_curve_selection_spherical(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_point_selection_projected(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_point_selection_spherical(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_projected(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_spherical(), pow3f(), pow4f(), pow7f(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::projected_snake_hook(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::reduce_density_projected(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::reduce_density_spherical(), blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry(), blender::bke::mesh_surface_sample::sample_surface_points_spherical(), SCULPT_calc_vertex_displacement(), blender::ed::curves::select_circle(), blender::ed::curves::select_circle_mask(), blender::geometry::curve_constraints::solve_length_and_collision_constraints(), sphclassical_force_cb(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::spherical_snake_hook(), ui_numedit_but_HISTOGRAM(), UI_view2d_dot_grid_draw(), blender::ed::sculpt_paint::use_add_density_mode(), and WM_gesture_lasso_modal().

◆ pow3f()

◆ pow4f()

◆ pow5f()

MINLINE float pow5f ( float x)

Definition at line 41 of file math_base_inline.cc.

References MINLINE, pow4f(), and x.

Referenced by kelvinlet_scale(), and kelvinlet_twist().

◆ pow7f()

MINLINE float pow7f ( float x)

Definition at line 45 of file math_base_inline.cc.

References MINLINE, pow2f(), pow3f(), and x.

Referenced by sphclassical_force_cb().

◆ power_of_2()

◆ power_of_2_max_i()

MINLINE int power_of_2_max_i ( int n)

Returns next (or previous) power of 2 or the input number if it is already a power of 2.

Definition at line 109 of file math_base_inline.cc.

References is_power_of_2_i(), and MINLINE.

Referenced by array_chunk_size_calc(), checker_board_color_fill(), blender::compositor::jump_flooding(), blender::eevee::RayTraceModule::render(), set_profile_spacing(), and blender::eevee::RayTraceModule::sync().

◆ power_of_2_max_u()

◆ power_of_2_min_i()

MINLINE int power_of_2_min_i ( int n)

◆ ratiod()

◆ ratiof()

MINLINE float ratiof ( float min,
float max,
float pos )

◆ round_db_to_int()

◆ round_db_to_int_clamp()

MINLINE int round_db_to_int_clamp ( double a)

Definition at line 208 of file math_base_inline.cc.

References _round_clamp_db_impl.

Referenced by ui_but_value_set().

◆ round_db_to_short_clamp()

MINLINE short round_db_to_short_clamp ( double a)

Definition at line 206 of file math_base_inline.cc.

References _round_clamp_db_impl.

Referenced by ui_but_value_set().

◆ round_db_to_uchar_clamp()

MINLINE unsigned char round_db_to_uchar_clamp ( double a)

Definition at line 204 of file math_base_inline.cc.

References _round_clamp_db_impl, and MINLINE.

Referenced by ui_but_value_set().

◆ round_fl_to_int()

MINLINE int round_fl_to_int ( float a)

Definition at line 192 of file math_base_inline.cc.

References _round_fl_impl.

Referenced by actkeys_framejump_exec(), blender::ed::vse::align_frame_with_pixel(), ANIM_channel_draw_widgets(), blender::ed::transform::applySeqSlide(), area_move_apply_do(), area_snap_calc_location(), BLF_position(), BLI_timecode_string_from_time(), BLI_timecode_string_from_time_seconds(), change_frame_apply(), blender::ed::transform::cmp_fn(), blender::seq::do_render_strip_uncached(), draw_background(), blender::ed::vse::draw_channels(), blender::ed::vse::draw_seq_waveform_overlay(), ED_annotation_draw_view3d(), ED_area_global_max_size_y(), ED_area_global_min_size_y(), ED_area_global_size_y(), ED_fileselect_init_layout(), ED_markers_find_nearest_marker_time(), ED_markers_post_apply_transform(), ED_region_panel_category_gutter_calc_rect(), ED_region_panels_draw(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::execute(), file_add_icon_but(), file_draw_list(), file_draw_string(), blender::ed::transform::flushTransSeq(), frame_from_event(), frame_from_event(), gather_frames_to_render_for_adt(), graphkeys_framejump_exec(), graphkeys_previewrange_exec(), graphview_cursor_apply(), icon_draw_rect(), blender::seq::image_size_to_thumb_size(), blender::ed::vse::label_str_get(), MOD_meshcache_calc_range(), blender::ed::vse::mouse_over_key_get_from_strip(), nlaedit_previewrange_exec(), blender::ed::space_node::node_draw_basis(), blender::ed::space_node::node_draw_collapsed(), blender::ed::outliner::outliner_draw_overrides_rna_buts(), panel_draw_aligned_widgets(), blender::ui::AbstractTreeView::persistent_state_apply(), previewrange_define_exec(), blender::ed::transform::recalcData_actedit(), blender::ed::transform::recalcData_sequencer_retiming(), blender::seq::render_give_stripelem(), blender::seq::retiming_key_speed_get(), blender::seq::retiming_key_speed_set(), blender::seq::retiming_key_timeline_frame_get(), blender::seq::seq_proxy_fetch(), blender::seq::seq_render_movie_strip_custom_file_proxy(), blender::seq::seq_render_movie_strip_view(), blender::ed::transform::seq_snap_threshold_get_frame_distance(), blender::seq::seq_split_set_left_hold_offset(), blender::seq::seq_split_set_right_hold_offset(), blender::ed::vse::sequencer_main_cursor(), blender::ed::vse::sequencer_slip_modal(), blender::ed::vse::sequencer_split_invoke(), blender::ed::transform::snap_calc_timeline(), blender::ed::greasepencil::snap_selected_frames(), blender::ed::vse::strip_get_thumb_image_dimensions(), blender::seq::strip_speed_effect_target_frame_get(), blender::ed::vse::sync_active_scene_and_time_with_scene_strip(), text_draw_rect_get(), blender::seq::time_get_rounded_sound_offset(), blender::ed::transform::transform_convert_sequencer_clamp(), ui_do_drag(), ui_numedit_but_NUM(), ui_numedit_but_SLI(), UI_panel_category_draw_all(), UI_preview_tile_size_x(), UI_preview_tile_size_y(), UI_preview_tile_size_y_no_label(), uiAlignPanelStep(), uilist_resize_update(), view2d_draw_lines(), widget_draw_text(), widget_draw_text_icon(), wm_drag_imbuf_icon_height_get(), wm_drag_imbuf_icon_width_get(), WM_event_drag_direction(), and wm_software_cursor_draw_bitmap().

◆ round_fl_to_int_clamp()

MINLINE int round_fl_to_int_clamp ( float a)

Definition at line 202 of file math_base_inline.cc.

References _round_clamp_fl_impl.

Referenced by ui_do_but_NUM().

◆ round_fl_to_short()

MINLINE short round_fl_to_short ( float a)

◆ round_fl_to_uchar()

MINLINE unsigned char round_fl_to_uchar ( float a)

Definition at line 190 of file math_base_inline.cc.

References _round_fl_impl, and MINLINE.

Referenced by blender::color::ByteTraits::round().

◆ round_fl_to_uchar_clamp()

MINLINE unsigned char round_fl_to_uchar_clamp ( float a)

◆ round_fl_to_uint()

MINLINE unsigned int round_fl_to_uint ( float a)

Definition at line 193 of file math_base_inline.cc.

References _round_fl_impl.

Referenced by blf_ensure_size(), and blf_font_size().

◆ round_to_even()

MINLINE float round_to_even ( float f)

Round to closest even number, halfway cases are rounded away from zero.

Definition at line 213 of file math_base_inline.cc.

References MINLINE, and roundf.

◆ signf()

MINLINE float signf ( float f)

Definition at line 565 of file math_base_inline.cc.

◆ signum_i()

◆ signum_i_ex()

MINLINE int signum_i_ex ( float a,
float eps )

Definition at line 581 of file math_base_inline.cc.

References eps, and MINLINE.

Referenced by BLI_polyfill_edge_calc_rotate_beauty__area().

◆ smoothminf()

◆ smoothstep()

◆ sqrt3d()

MINLINE double sqrt3d ( double d)

Definition at line 61 of file math_base_inline.cc.

References exp, log, MINLINE, and UNLIKELY.

Referenced by solve_cubic().

◆ sqrt3f()

MINLINE float sqrt3f ( float f)

Definition at line 50 of file math_base_inline.cc.

References exp, float, log, MINLINE, and UNLIKELY.

Referenced by ui_numedit_but_HSVCIRCLE().

◆ sqrtf_signed()

MINLINE float sqrtf_signed ( float f)

Definition at line 72 of file math_base_inline.cc.

References MINLINE, and sqrtf.

Referenced by blender::seq::invGammaCorrect(), mesh_calc_eigen_matrix(), and modify_mesh().

◆ square_f()

MINLINE float square_f ( float a)

Definition at line 301 of file math_base_inline.cc.

References MINLINE.

Referenced by BKE_brush_jitter_pos(), bm_edge_symmetry_map(), bm_edgexedge_isect_impl(), bm_edgexvert_isect_impl(), BM_mesh_intersect_edges(), bmo_planar_faces_exec(), blender::ed::sculpt_paint::brush_delta_update(), calc_duplicates_fast(), calctrackballvec(), cloth_collision_response_static(), cloth_selfcollision_response_static(), contarget_get_mesh_mat(), blender::ed::curves::curve_draw_event_add(), curve_draw_event_add(), blender::ed::curves::curve_draw_exec_precalc(), curve_draw_exec_precalc(), curve_draw_modal(), blender::ed::curves::curves_draw_modal(), blender::deform_drawing(), deformVerts_do(), dist_squared_ray_to_seg_v3(), dynamic_paint_find_island_border(), EDBM_verts_mirror_cache_begin_ex(), execute_posetree(), gizmo_arrow_test_select(), blender::workbench::CavityEffect::init(), is_quad_convex_v3(), isect_seg_seg_v2_point_ex(), len_squared_vnvn(), blender::bke::pbvh::long_edge_queue_edge_add_recursive(), mat4_to_dquat(), blender::bke::mesh_edges_spherecast(), blender::geometry::mesh_merge_by_distance_connected(), mesh_remove_doubles_on_axis(), mouse_to_plane_slide_zone_distance_squared(), mouse_to_slide_zone_distance_squared(), object_mouse_select_menu(), blender::ed::sculpt_paint::paint_smooth_stroke(), py_bvhtree_find_nearest_range(), blender::eevee::Sampling::sample_ball(), blender::eevee::Sampling::sample_hemisphere(), blender::eevee::Sampling::sample_sphere(), blender::ed::transform::snap_object_project_view3d_ex(), blender::ed::transform::snap_target_uv_fn(), sphere_normal_from_uv(), spline_under_mouse_get(), blender::ed::vse::strip_select_from_preview(), blender::eevee::BackgroundPipeline::sync(), blender::bke::tests::TEST(), ui_do_but_CURVE(), ui_do_but_CURVEPROFILE(), uv_find_nearest_edge(), uv_find_nearest_vert(), uv_image_outset(), uv_nearest_hit_init_dist_px(), v3d_cursor_plane_draw(), warpModifier_do(), and WM_gesture_lasso_modal().

◆ square_i()

◆ square_s()

MINLINE int square_s ( short a)

Definition at line 286 of file math_base_inline.cc.

References MINLINE.

Referenced by project_state_init().

◆ square_uint()

◆ ulp_diff_ff()

MINLINE uint ulp_diff_ff ( float a,
float b )

Computes the distance between two floats in ulps.

In other words, returns zero if the floats are exactly equal, and otherwise returns 1 plus the number of (unique) representable floats between a and b on the number line.

Notes:

  • The order of a and b doesn't matter. The returned value is the absolute difference.
  • Unlike many ulp difference functions, this function handles the difference between positive and negative floats in a meaningful way. It returns the number (plus 1) of representable floats between those two values as they would be arranged on a number line.
  • Zero and negative zero are not considered unique from each other. They are counted together as a single float in the difference.
  • NaNs are not handled meaningfully. If either number is NaN, this function returns uint max (0xffffffff).

Definition at line 461 of file math_base_inline.cc.

References b, BLI_assert, i, and MINLINE.

Referenced by compare_ff_relative(), normalization_factor_get(), blender::tests::TEST(), and blender::animrig::tests::AnimationEvaluationTest::test_evaluate_layer().

◆ unit_float_to_uchar_clamp()

◆ unit_float_to_ushort_clamp()

◆ unit_ushort_to_uchar()

MINLINE unsigned char unit_ushort_to_uchar ( unsigned short val)

Definition at line 632 of file math_base_inline.cc.

References MINLINE.

Referenced by ushort_to_byte_dither_v4(), and ushort_to_byte_v4().

◆ wrapf()