replace lrint with lround

lrint is a configurable version of lround that behaves either as round,
floor, ceil, or trunc based on setting the proper FE_ macro using
fset/getround. Given that it's not set at all and that it defaults to
round behavior, simply replace with round.

Also removed the util/Math defines.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-03-24 17:10:34 -07:00 committed by Max Kellermann
parent e41a52d909
commit 4fd0c84f46
2 changed files with 2 additions and 5 deletions

View File

@ -273,7 +273,7 @@ AlsaMixer::GetVolume()
throw FormatRuntimeError("snd_mixer_handle_events() failed: %s",
snd_strerror(err));
return lrint(100 * get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT));
return lround(100 * get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT));
}
void
@ -282,7 +282,7 @@ AlsaMixer::SetVolume(unsigned volume)
assert(handle != nullptr);
double cur = get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT);
int delta = volume - lrint(100.*cur);
int delta = volume - lround(100.*cur);
int err = set_normalized_playback_volume(elem, cur + 0.01*delta, delta);
if (err < 0)
throw FormatRuntimeError("failed to set ALSA volume: %s",

View File

@ -32,12 +32,9 @@
#ifdef __UCLIBC__
#include <boost/math/special_functions/round.hpp>
using boost::math::iround;
using boost::math::lround;
#define lrint iround
#else
#include <cmath>
using std::lrint;
using std::lround;
#endif