Minor optimisation -- using do-while() instead of for() in isqrt32()
authorTimothy B. Terriberry <tterribe@xiph.org>
Wed, 27 May 2009 03:15:05 +0000 (23:15 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Wed, 27 May 2009 03:15:05 +0000 (23:15 -0400)
libcelt/cwrs.c

index 9a29247..8d2d762 100644 (file)
@@ -155,7 +155,7 @@ static unsigned isqrt32(celt_uint32_t _val){
   g=0;
   bshift=EC_ILOG(_val)-1>>1;
   b=1U<<bshift;
-  for(;bshift>=0;bshift--){
+  do{
     celt_uint32_t t;
     t=((celt_uint32_t)g<<1)+b<<bshift;
     if(t<=_val){
@@ -163,7 +163,9 @@ static unsigned isqrt32(celt_uint32_t _val){
       _val-=t;
     }
     b>>=1;
+    bshift--;
   }
+  while(bshift>=0);
   return g;
 }