From af2ae0eac42d07686dfd7332be30d8a4e75499fd Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 31 May 2010 13:43:33 +0000 Subject: [PATCH] reverting r9177: pow() is a basic math function and should be used instead of a hack --- libtransmission/utils.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libtransmission/utils.c b/libtransmission/utils.c index 5002f3eb1..128cb222d 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -1342,9 +1342,8 @@ tr_parseNumberRange( const char * str_in, int len, int * setmeCount ) double tr_truncd( double x, int decimal_places ) { - static const int multiplier[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 }; - const int64_t i = multiplier[decimal_places]; - double x2 = (int64_t)(x*i); + const int i = (int) pow( 10, decimal_places ); + double x2 = (int)(x*i); return x2 / i; }