[FFmpeg-devel] [PATCH 2/5] vp56rac: Replace /256 with >>8

Rafaël Carré rafael.carre
Tue Jun 15 16:17:09 CEST 2010


On Tue, 15 Jun 2010 09:02:15 -0400
David Conrad <lessen42 at gmail.com> wrote:

Hi,

> -    unsigned int low = 1 + (((c->high - 1) * prob) / 256);
> +    unsigned int low = 1 + (((c->high - 1) * prob) >> 8);

I thought decent compilers would optimize divisons/modulos using power
of 2, at least gcc 4.0.3 does it at -O0

For example /64 and %64 were added in r23602 (although here it uses
signed operands and not unsigned), so if some compiler can't do this,
all divisions/modulos using integer power of 2 should be changed? (i
didn't grep for all of them)

-- 
#define _ putchar
int x=0,q=0,Z;z(){while(x<4){Z=(x?x:x^3)*5+(x>>1);_(((x++??'3)?Z:'['<<
1)+((13<<3)+2));}x=0;}char *s="ACB=+2DBK/,8=\"";main(){z();while(s[q])
{Z=s[q++]+q+43;Z=Z=='Z'?1<<5:Z;Z^0x7e?_(Z):_(' ')+z();}_((1<<3+3)+3);}

//Rafa?l Carr?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100615/0cb020a7/attachment.pgp>



More information about the ffmpeg-devel mailing list