summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-01 14:06:20 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 01:48:48 +0200
commit7fe8260c6c0a53fdc9ba04130c577122402a82ec (patch)
tree24955659f26eca7491c37a89ca8b4cb2483cf4c5
parentc4d7cb7a132a59804a2bb1fc0e5ef3e676dc5431 (diff)
downloadingen-7fe8260c6c0a53fdc9ba04130c577122402a82ec.tar.gz
ingen-7fe8260c6c0a53fdc9ba04130c577122402a82ec.tar.bz2
ingen-7fe8260c6c0a53fdc9ba04130c577122402a82ec.zip
Use type-appropriate math functions
-rw-r--r--.clang-tidy1
-rw-r--r--src/gui/rgba.hpp2
-rw-r--r--src/server/internals/Controller.cpp4
3 files changed, 3 insertions, 4 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 3e13f36e..683b7aab 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -68,7 +68,6 @@ Checks: >
-modernize-use-trailing-return-type,
-modernize-use-using,
-performance-no-automatic-move,
- -performance-type-promotion-in-math-fn,
-performance-unnecessary-value-param,
-portability-simd-intrinsics,
-readability-avoid-const-params-in-decls,
diff --git a/src/gui/rgba.hpp b/src/gui/rgba.hpp
index 949a80d7..ffd63f82 100644
--- a/src/gui/rgba.hpp
+++ b/src/gui/rgba.hpp
@@ -34,7 +34,7 @@ rgba_to_uint(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
static inline uint8_t
mono_interpolate(uint8_t v1, uint8_t v2, float f)
{
- return static_cast<int>(rint((v2) * (f) + (v1) * (1 - (f))));
+ return static_cast<int>(rintf((v2) * (f) + (v1) * (1 - (f))));
}
#define RGBA_R(x) (static_cast<uint32_t>(x) >> 24)
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index 1a6bb483..a4f7ef43 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -160,8 +160,8 @@ ControllerNode::control(RunContext& context, uint8_t control_num, uint8_t val, F
if (min_port_val < 0) {
log_offset = fabs(min_port_val);
}
- const Sample min = log(min_port_val + 1 + log_offset);
- const Sample max = log(max_port_val + 1 + log_offset);
+ const Sample min = logf(min_port_val + 1 + log_offset);
+ const Sample max = logf(max_port_val + 1 + log_offset);
scaled_value = expf(nval * (max - min) + min) - 1 - log_offset;
} else {
scaled_value = ((nval) * (max_port_val - min_port_val)) + min_port_val;