diff options
author | Daniela-Marinela Bistrean <daniela.marinela.bistrean@gmail.com> | 2019-04-12 00:49:20 +0300 |
---|---|---|
committer | Daniela-Marinela Bistrean <daniela.marinela.bistrean@gmail.com> | 2019-04-12 01:27:52 +0300 |
commit | 9962e710f7d79afbfb956b03b064dd2fc7b1783f (patch) | |
tree | 96e947d4f5885949a32632c6936a41f909a25f75 | |
parent | 52c1bf5fbdc4c9a47825a1da5e5b7340f35cef66 (diff) |
Fix integer division issue in int_to_percent function
Changed order of operations to preserve the precision during the division.
-rw-r--r-- | src/mixer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mixer.c b/src/mixer.c index 742c231..e496e18 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -552,7 +552,7 @@ static int int_to_percent(const struct snd_ctl_elem_info *ei, int value) if (range == 0) return 0; - return ((value - ei->value.integer.min) / range) * 100; + return ((value - ei->value.integer.min) * 100) / range; } /** Gets a percentage representation of a specified control value. |