Commit 621327e3 authored by michael's avatar michael

reduce number of shifts


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@8891 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent f7856fd2
...@@ -189,15 +189,16 @@ extern const uint8_t ff_sqrt_tab[128]; ...@@ -189,15 +189,16 @@ extern const uint8_t ff_sqrt_tab[128];
static inline int ff_sqrt(int a) static inline int ff_sqrt(int a)
{ {
int ret=0; int ret=0;
int s; int s, b;
if(a<128) return ff_sqrt_tab[a]; if(a<128) return ff_sqrt_tab[a];
for(s=15; s>=0; s--){ for(s=30; s>=0; s-=2){
int b= (1<<(s*2)) + (ret<<s)*2; ret+=ret;
b= (1+2*ret)<<s;
if(b<=a){ if(b<=a){
a-=b; a-=b;
ret+= 1<<s; ret++;
} }
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment