From: kramm Date: Sat, 10 Sep 2005 12:30:01 +0000 (+0000) Subject: dump out a warning if there's an overflow during matrix multiplication X-Git-Tag: xpdf-3-01~72 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=e9dc83904a5df2c24cc62004be16cecdaea83797 dump out a warning if there's an overflow during matrix multiplication --- diff --git a/lib/modules/swftools.c b/lib/modules/swftools.c index 5f16339..37c8e8b 100644 --- a/lib/modules/swftools.c +++ b/lib/modules/swftools.c @@ -26,8 +26,11 @@ #define S64 long long SFIXED RFXSWF_SP(SFIXED a1,SFIXED a2,SFIXED b1,SFIXED b2) { S64 a; - a = (S64)a1*(S64)b1+(S64)a2*(S64)b2; - return (SFIXED)(a>>16); + a = ((S64)a1*(S64)b1+(S64)a2*(S64)b2)>>16; + SFIXED result = (SFIXED)(a); + if(a!=result) + fprintf(stderr, "Warning: overflow in matrix multiplication"); + return result; } SFIXED RFXSWF_QFIX(int zaehler,int nenner) // bildet Quotient von zwei INTs in SFIXED { S64 z = zaehler<<16;