diff options
author | davilla <davilla@4pi.com> | 2011-07-23 19:01:59 -0400 |
---|---|---|
committer | davilla <davilla@4pi.com> | 2011-07-23 19:01:59 -0400 |
commit | 18528b09d547b864cba871582dc3ddd6986c0ead (patch) | |
tree | a6c49cf4df5062390f04f3480b1fea46b03fb7c7 | |
parent | d5c549f85050f6eefb86941a2eb785700dccc420 (diff) |
revert rounding change to only alter arm platform
-rw-r--r-- | xbmc/utils/MathUtils.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xbmc/utils/MathUtils.h b/xbmc/utils/MathUtils.h index 1063ed8c3c..12245cd093 100644 --- a/xbmc/utils/MathUtils.h +++ b/xbmc/utils/MathUtils.h @@ -36,16 +36,6 @@ namespace MathUtils const float round_to_nearest = 0.5f; int i; - //BIG FIXME here - //the asm codes below do the following - trunc(x+0.5) - //this isn't correct for negativ x - values - for example - //-1 gets rounded to zero because trunc(-1+0.5) == 0 - //this is a dirty hack until someone fixes this propably in asm - //i've created a trac ticket for this #11767 - //this hacks decrements the x by 1 if it is negativ - // so for -1 it would be trunc(-2+0.5) - which would be correct -1 then ... - x = x < 0 ? x-1 : x; - #ifndef _LINUX __asm { @@ -59,6 +49,16 @@ namespace MathUtils #if defined(__powerpc__) || defined(__ppc__) i = floor(x + round_to_nearest); #elif defined(__arm__) + //BIG FIXME here (still has issues with rounding -0.5 to zero and not -1) + //the asm codes below do the following - trunc(x+0.5) + //this isn't correct for negativ x - values - for example + //-1 gets rounded to zero because trunc(-1+0.5) == 0 + //this is a dirty hack until someone fixes this propably in asm + //i've created a trac ticket for this #11767 + //this hacks decrements the x by 1 if it is negativ + // so for -1 it would be trunc(-2+0.5) - which would be correct -1 then ... + x = x < 0 ? x-1 : x; + __asm__ __volatile__ ( "vmov.F64 d1,%[rnd_val] \n\t" // Copy round_to_nearest into a working register "vadd.F64 %P[value],%P[value],d1 \n\t" // Add round_to_nearest to value |