diff options
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/math_base_inline.c | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vec.cc | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/mesh_boolean.cc | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 6481fac5a14..2a7c091d1b9 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -192,6 +192,13 @@ MINLINE double ratiod(double min, double max, double pos) return range == 0 ? 0 : ((pos - min) / range); } +/* Map a normalized value, i.e. from interval [0, 1] to interval [a, b] */ +MINLINE float scalenorm(float a, float b, float x) +{ + BLI_assert(x <= 1 && x >= 0); + return (x * (b - a)) + a; +} + /* used for zoom values*/ MINLINE float power_of_2(float val) { diff --git a/source/blender/blenlib/intern/math_vec.cc b/source/blender/blenlib/intern/math_vec.cc index 1d138d0b0f4..223c0e273f0 100644 --- a/source/blender/blenlib/intern/math_vec.cc +++ b/source/blender/blenlib/intern/math_vec.cc @@ -173,7 +173,7 @@ mpq3 mpq3::cross_poly(Span<mpq3> poly) uint64_t hash_mpq_class(const mpq_class &value) { /* TODO: better/faster implementation of this. */ - return DefaultHash<float>{}(static_cast<float>(value.get_d())); + return get_default_hash(static_cast<float>(value.get_d())); } uint64_t mpq2::hash() const diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index bc12ff1a652..bf70b044d0d 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -97,10 +97,7 @@ class Edge { uint64_t hash() const { - constexpr uint64_t h1 = 33; - uint64_t v0hash = DefaultHash<int>{}(v_[0]->id); - uint64_t v1hash = DefaultHash<int>{}(v_[1]->id); - return v0hash ^ (v1hash * h1); + return get_default_hash_2(v_[0]->id, v_[1]->id); } }; |