aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-05-04 22:35:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-05-04 22:35:56 +0000
commit45221f7f61828bdf8eb4df3576724d3e9966c227 (patch)
tree7a90e7660b0847d55971eedd58d612a4e94f3d68 /libavutil
parentfd735e4b77a2e973b890c328805ee029dfe4b318 (diff)
downloadffmpeg-45221f7f61828bdf8eb4df3576724d3e9966c227.tar.gz
reduce number of shifts
Originally committed as revision 8891 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/internal.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 244e3c0dde..ce168ddfee 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -189,15 +189,16 @@ extern const uint8_t ff_sqrt_tab[128];
static inline int ff_sqrt(int a)
{
int ret=0;
- int s;
+ int s, b;
if(a<128) return ff_sqrt_tab[a];
- for(s=15; s>=0; s--){
- int b= (1<<(s*2)) + (ret<<s)*2;
+ for(s=30; s>=0; s-=2){
+ ret+=ret;
+ b= (1+2*ret)<<s;
if(b<=a){
a-=b;
- ret+= 1<<s;
+ ret++;
}
}
return ret;