From 45221f7f61828bdf8eb4df3576724d3e9966c227 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 4 May 2007 22:35:56 +0000 Subject: [PATCH] reduce number of shifts Originally committed as revision 8891 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavutil/internal.h | 9 +++++---- 1 file 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<=0; s-=2){ + ret+=ret; + b= (1+2*ret)<