]> www.ginac.de Git - cln.git/blobdiff - src/base/digitseq/cl_DS_mul.cc
2006-04-25 Bruno Haible <bruno@clisp.org>
[cln.git] / src / base / digitseq / cl_DS_mul.cc
index e1f94a411398ca0e504ab3a9094b11c5324a7b1b..5400e7f25b932c0a5512208f4c307945f232e924 100644 (file)
@@ -354,15 +354,20 @@ namespace cln {
   const unsigned int cl_fftm_threshold2 = 2*cl_fftm_threshold;
   //   len1 > cl_fftm_threshold1 && len2 > cl_fftm_threshold2
   //   && len1 >= cl_fftm_threshold1 + cl_fftm_threshold/(len2-cl_fftm_threshold1)*(cl_fftm_threshold-cl_fftm_threshold1).
-  static inline cl_boolean cl_fftm_suitable (uintL len1, uintL len2)
+  static inline cl_boolean cl_fftm_suitable (uintC len1, uintC len2)
     { if (len1 >= cl_fftm_threshold)
         return cl_true;
       if (len1 > cl_fftm_threshold1)
         if (len2 > cl_fftm_threshold2)
-          { var uint32 hi;
+          { const unsigned int prod_threshold = cl_fftm_threshold*(cl_fftm_threshold-cl_fftm_threshold1);
+            if (len1-cl_fftm_threshold1 >= prod_threshold)
+              return cl_true;
+            if (len2-cl_fftm_threshold1 >= prod_threshold)
+              return cl_true;
+            var uint32 hi;
             var uint32 lo;
             mulu32(len1-cl_fftm_threshold1,len2-cl_fftm_threshold1, hi=,lo=);
-            if (hi > 0 || lo >= cl_fftm_threshold*(cl_fftm_threshold-cl_fftm_threshold1))
+            if (hi > 0 || lo >= prod_threshold)
               return cl_true;
           }
       return cl_false;