[Ecm-commits] r2580 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Thu Feb 5 08:04:46 CET 2015


Author: zimmerma
Date: 2015-02-05 08:04:46 +0100 (Thu, 05 Feb 2015)
New Revision: 2580

Modified:
   trunk/auxi.c
Log:
replace code by ASSERT_ALWAYS


Modified: trunk/auxi.c
===================================================================
--- trunk/auxi.c	2015-02-04 06:35:14 UTC (rev 2579)
+++ trunk/auxi.c	2015-02-05 07:04:46 UTC (rev 2580)
@@ -139,16 +139,8 @@
   mpz_gcd (f, g, n->n);
 
     /* When GPU is not used, the factor should divide n->n */
-    if (mpz_cmp (g, f) != 0 && gpu == 0)
-      {
-        fprintf (stderr, "Error: factor ");
-        mpz_out_str (stderr, 10, f);
-        fprintf (stderr, "does not divide ");
-        mpz_out_str (stderr, 10, n->n);
-        fprintf (stderr, "\nPlease report internal errors at <%s>.\n",
-                 PACKAGE_BUGREPORT);
-        exit (EXIT_FAILURE);
-      }
+    if (gpu == 0)
+      ASSERT_ALWAYS(mpz_cmp (g, f) == 0);
     else if (mpz_cmp (g, f) != 0 && gpu != 0 && mpz_cmp_ui (f, 1) == 0)
     /* On GPU all factors of g were already found */
       {
@@ -168,14 +160,7 @@
       }
 
   /* Complain about non-proper factors (0, negative) */
-  if (mpz_cmp_ui (f, 1) < 0)
-    {
-      fprintf (stderr, "Error: factor found is ");
-      mpz_out_str (stderr, 10, f);
-      fprintf (stderr, "\nPlease report internal errors at <%s>.\n",
-               PACKAGE_BUGREPORT);
-      exit (EXIT_FAILURE);
-    }
+  ASSERT_ALWAYS(mpz_cmp_ui (f, 1) >= 1);
   
   if (mpz_cmp (f, n->n) != 0)
     {



More information about the Ecm-commits mailing list