summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/time-smoother.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-10-03 02:34:59 +0200
committerLennart Poettering <lennart@poettering.net>2008-10-03 02:34:59 +0200
commit33b186e74dc2de6fa363d10d3450c354ec99f864 (patch)
tree5404257a2dd9c2547eeb08ddb30417f49a096d4b /src/pulsecore/time-smoother.c
parent1bb5e58fb38f3cd4b2c389dd3da294b004eade56 (diff)
user lrint() and friends in inner loops instead of normal C casts to speed up a few things
Diffstat (limited to 'src/pulsecore/time-smoother.c')
-rw-r--r--src/pulsecore/time-smoother.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pulsecore/time-smoother.c b/src/pulsecore/time-smoother.c
index b165f4a8..6a2ffaa6 100644
--- a/src/pulsecore/time-smoother.c
+++ b/src/pulsecore/time-smoother.c
@@ -284,7 +284,7 @@ static void estimate(pa_smoother *s, pa_usec_t x, pa_usec_t *y, double *deriv) {
/* The requested point is right of the point where we wanted
* to be on track again, thus just linearly estimate */
- t = (int64_t) s->py + (int64_t) (s->dp * (double) (x - s->px));
+ t = (int64_t) s->py + (int64_t) llrint(s->dp * (double) (x - s->px));
if (t < 0)
t = 0;
@@ -313,7 +313,7 @@ static void estimate(pa_smoother *s, pa_usec_t x, pa_usec_t *y, double *deriv) {
/* Move back from origin */
ty += (double) s->ey;
- *y = ty >= 0 ? (pa_usec_t) ty : 0;
+ *y = ty >= 0 ? (pa_usec_t) lrint(ty) : 0;
/* Horner scheme */
if (deriv)
@@ -360,7 +360,7 @@ void pa_smoother_put(pa_smoother *s, pa_usec_t x, pa_usec_t y) {
/* And calculate when we want to be on track again */
s->px = s->ex + s->adjust_time;
- s->py = s->ry + (pa_usec_t) (s->dp * (double) s->adjust_time);
+ s->py = s->ry + (pa_usec_t) lrint(s->dp * (double) s->adjust_time);
s->abc_valid = FALSE;
@@ -456,7 +456,7 @@ pa_usec_t pa_smoother_translate(pa_smoother *s, pa_usec_t x, pa_usec_t y_delay)
/* pa_log_debug("translate(%llu) = %llu (%0.2f)", (unsigned long long) y_delay, (unsigned long long) ((double) y_delay / nde), nde); */
- return (pa_usec_t) ((double) y_delay / nde);
+ return (pa_usec_t) lrint((double) y_delay / nde);
}
void pa_smoother_reset(pa_smoother *s) {