shithub: opus

Download patch

ref: 6391fe82298c5ff673e0249a2b48f2f9fef51ecd
parent: 7aa0ed40c1b0ae4edccb6fb6bafafdc9fcdef073
author: Timothy B. Terriberry <[email protected]>
date: Tue May 26 19:15:05 EDT 2009

Minor optimisation -- using do-while() instead of for() in isqrt32()

--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -155,7 +155,7 @@
   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 @@
       _val-=t;
     }
     b>>=1;
+    bshift--;
   }
+  while(bshift>=0);
   return g;
 }