dump out a warning if there's an overflow during matrix multiplication
authorkramm <kramm>
Sat, 10 Sep 2005 12:30:01 +0000 (12:30 +0000)
committerkramm <kramm>
Sat, 10 Sep 2005 12:30:01 +0000 (12:30 +0000)
lib/modules/swftools.c

index 5f16339..37c8e8b 100644 (file)
 #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;