[xiph-commits] r12061 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Nov 7 12:35:31 PST 2006


Author: xiphmont
Date: 2006-11-07 12:35:29 -0800 (Tue, 07 Nov 2006)
New Revision: 12061

Modified:
   trunk/sushivision/scale.c
Log:
Go to an integer implementation of trailing_zeros to avoid float-optimization-related infinite loops.



Modified: trunk/sushivision/scale.c
===================================================================
--- trunk/sushivision/scale.c	2006-11-07 20:18:20 UTC (rev 12060)
+++ trunk/sushivision/scale.c	2006-11-07 20:35:29 UTC (rev 12061)
@@ -30,13 +30,11 @@
 /* slider scales */
 static int trailing_zeroes(double A){
   int count=0;
-  if(A<0)A=-A;
-  if(A==0)return 0;
-  A = floor(A);
-  A/=10;
-  while(A == floor(A)){
+  int64_t iA = (A<0 ? floor(-A) : floor(A));;
+  if(iA==0)return 0;
+  while(!(iA%10)){
     count++;
-    A/=10;
+    iA/=10;
   }
   return count;
 }



More information about the commits mailing list