summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sample-util.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/sample-util.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/sample-util.c')
-rw-r--r--src/pulsecore/sample-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index b4e8bf4b..5119ebd3 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -105,7 +105,7 @@ static void calc_linear_integer_volume(int32_t linear[], const pa_cvolume *volum
pa_assert(volume);
for (channel = 0; channel < volume->channels; channel++)
- linear[channel] = (int32_t) (pa_sw_volume_to_linear(volume->values[channel]) * 0x10000);
+ linear[channel] = lrint(pa_sw_volume_to_linear(volume->values[channel]) * 0x10000);
}
static void calc_linear_float_volume(float linear[], const pa_cvolume *volume) {
@@ -132,7 +132,7 @@ static void calc_linear_integer_stream_volumes(pa_mix_info streams[], unsigned n
for (channel = 0; channel < spec->channels; channel++) {
pa_mix_info *m = streams + k;
- m->linear[channel].i = (int32_t) (pa_sw_volume_to_linear(m->volume.values[channel]) * linear[channel] * 0x10000);
+ m->linear[channel].i = lrint(pa_sw_volume_to_linear(m->volume.values[channel]) * linear[channel] * 0x10000);
}
}
}