13
0

Fix region-fade, time-stretch and other scaling operations (#9057)

This resolves an ambiguity between abs(int) and std::abs(T) which
depends on context and compiler version and optimization.

In context of #9057, (gcc-6.3 -O3) math.h `abs(int)` was used. This
truncated the superclock value to 31 bit in ControlList::extend_to.
This commit is contained in:
Robin Gareus 2023-01-12 16:17:39 +01:00
parent 117cfc844b
commit 6407ca51cd
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -67,8 +67,8 @@ class _ratio_t {
public:
/* do not allow negative values, this is just a ratio */
_ratio_t (T n, T d) : _numerator (abs (n)), _denominator (abs(d)) { assert (_denominator != 0); }
_ratio_t (T n) : _numerator (abs (n)), _denominator (1) {}
_ratio_t (T n, T d) : _numerator (std::abs (n)), _denominator (std::abs(d)) { assert (_denominator != 0); }
_ratio_t (T n) : _numerator (std::abs (n)), _denominator (1) {}
T numerator() const { return _numerator; }
T denominator() const { return _denominator; }