diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-05-04 22:35:56 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-05-04 22:35:56 +0000 |
commit | 45221f7f61828bdf8eb4df3576724d3e9966c227 (patch) | |
tree | 7a90e7660b0847d55971eedd58d612a4e94f3d68 /libavutil | |
parent | fd735e4b77a2e973b890c328805ee029dfe4b318 (diff) | |
download | ffmpeg-streaming-45221f7f61828bdf8eb4df3576724d3e9966c227.zip ffmpeg-streaming-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.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h index 244e3c0..ce168dd 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; |