Conversions from int to unsigned int to ensure correct execution of int_min at line...
[openjpeg.git] / libopenjpeg / fix.c
index 77ca6d630f9ec354a298c3c5820221adf21aae39..12ef6a7e66cccc0fb1c68fa0bf9186ed429bfe69 100644 (file)
@@ -42,7 +42,9 @@
 //  return (int) ((int64) a * (int64) b >> 13);
 //}
 
+
 //Mod Antonin : multbug1
+/*
 int fix_mul(int a, int b)
 {
   double tmp= (double) ((int64) a * (int64) b);
@@ -50,5 +52,12 @@ int fix_mul(int a, int b)
   v = (tmp<0)?-v:v;
   return (int) v;
 }
+*/
 //doM
 
+int fix_mul(int a, int b)   // Luke Lee optimized : 11/16/2004
+{
+    int64 temp = (int64) a * (int64) b >> 12;
+    return (int) ((temp >> 1) + (temp & 1)) ;
+}
+