/* Function to convert from percentage to volume. val = percentage */
-#ifdef HAVE_SOFT_FLOAT
-static inline long int convert_prange1(long val, long min, long max)
+static inline long int convert_prange1(long perc, long min, long max)
{
- long temp = val * (max - min);
- return temp / 100 + min + ((temp % 100) == 0 ? 0 : 1);
-}
-#else
+ long tmp;
-#define convert_prange1(val, min, max) \
- ceil((val) * ((max) - (min)) * 0.01 + (min))
+#ifdef HAVE_SOFT_FLOAT
+ tmp = perc * (max - min);
+ tmp = tmp / 100 + ((tmp % 100) < 50 ? 0 : 1);
+#else
+ tmp = rint((double)perc * (double)(max - min) * 0.01);
#endif
+ if (tmp == 0 && perc > 0)
+ tmp++;
+ return tmp + min;
+}
#define check_range(val, min, max) \
((val < min) ? (min) : ((val > max) ? (max) : (val)))