Temporal: correctly construct return timepos_t for * and /
This commit is contained in:
parent
e89d727939
commit
8ec81c2308
@ -198,6 +198,10 @@ class timepos_t : public int62_t {
|
||||
|
||||
private:
|
||||
int64_t v;
|
||||
/* special private constructor for use when constructing timepos_t as a
|
||||
return value using arithmetic ops
|
||||
*/
|
||||
explicit timepos_t (bool b, int64_t v) : int62_t (b, v) {}
|
||||
|
||||
static timepos_t _max_timepos;
|
||||
|
||||
|
@ -264,14 +264,14 @@ timepos_t::operator/(ratio_t const & n) const
|
||||
|
||||
/* note: v / (N/D) = (v * D) / N */
|
||||
|
||||
return timepos_t (int_div_round (val() * n.denominator(), n.numerator()));
|
||||
return timepos_t (is_beats(), int_div_round (val() * n.denominator(), n.numerator()));
|
||||
}
|
||||
|
||||
timepos_t
|
||||
timepos_t::operator*(ratio_t const & n) const
|
||||
{
|
||||
assert (n >= 0); /* do not allow a position to become negative via multiplication */
|
||||
return timepos_t (int_div_round (val() * n.numerator(), n.denominator()));
|
||||
return timepos_t (is_beats(), int_div_round (val() * n.numerator(), n.denominator()));
|
||||
}
|
||||
|
||||
timepos_t &
|
||||
|
Loading…
Reference in New Issue
Block a user