13
0

libtemporal: when computing Beats from a ticks value, do not try to pass potentially overflowing ticks value

This commit is contained in:
Paul Davis 2021-02-13 21:57:30 -07:00
parent 1af74f7398
commit d576fc8ca9

View File

@ -119,8 +119,9 @@ public:
}
/** Create from ticks at the standard PPQN. */
static Beats ticks(int32_t ticks) {
return Beats(0, ticks);
static Beats ticks(int64_t ticks) {
assert (ticks/PPQN < std::numeric_limits<int32_t>::max());
return Beats (ticks / PPQN, ticks % PPQN);
}
/** Create from ticks at a given rate.