From e9dc83904a5df2c24cc62004be16cecdaea83797 Mon Sep 17 00:00:00 2001 From: kramm Date: Sat, 10 Sep 2005 12:30:01 +0000 Subject: [PATCH] dump out a warning if there's an overflow during matrix multiplication --- lib/modules/swftools.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; -- 1.7.10.4