From cb81b06a5dab77e40ce413f93222d497258f37fd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Sep 2021 17:32:37 +0200 Subject: [PATCH] Revert "Fix div/zero, allow switching backends" This reverts commit 1288262ca79135285ef0d189b48a7bb450588549. --- libs/pbd/pbd/integer_division.h | 4 ---- libs/temporal/temporal/superclock.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libs/pbd/pbd/integer_division.h b/libs/pbd/pbd/integer_division.h index 1eee8c58b3..323fbf03c8 100644 --- a/libs/pbd/pbd/integer_division.h +++ b/libs/pbd/pbd/integer_division.h @@ -32,10 +32,6 @@ template T int_div_round (T x, T y) { - if (y == 0) { - /* usually `y' is sample-rate, or beats/bar */ - return (x == 0) ? 0 : 1; - } /* essentially ((x + (y/2)) / y) but handles signed/negative values correcvtly */ return (x + PBD_IDIV_ROUNDING(x,y)) / y ; } diff --git a/libs/temporal/temporal/superclock.h b/libs/temporal/temporal/superclock.h index 7891d0096b..4eb2c02bf3 100644 --- a/libs/temporal/temporal/superclock.h +++ b/libs/temporal/temporal/superclock.h @@ -35,7 +35,7 @@ typedef int64_t superclock_t; static superclock_t superclock_ticks_per_second = 508032000; // 2^10 * 3^4 * 5^3 * 7^2 #endif -static inline superclock_t superclock_to_samples (superclock_t s, int sr) { return sr == 0 ? 0 : int_div_round (s * sr, superclock_ticks_per_second); } +static inline superclock_t superclock_to_samples (superclock_t s, int sr) { return int_div_round (s * sr, superclock_ticks_per_second); } static inline superclock_t samples_to_superclock (int64_t samples, int sr) { return int_div_round (samples * superclock_ticks_per_second, superclock_t (sr)); } extern int (*sample_rate_callback)();