r15303 - gnucash/trunk - Fix the printf routines in the qofmath tests.

Derek Atkins warlord at cvs.gnucash.org
Tue Jan 2 13:37:17 EST 2007


Author: warlord
Date: 2007-01-02 13:37:16 -0500 (Tue, 02 Jan 2007)
New Revision: 15303
Trac: http://svn.gnucash.org/trac/changeset/15303

Modified:
   gnucash/trunk/
   gnucash/trunk/lib/libqof/qof/qofmath128.c
Log:
Fix the printf routines in the qofmath tests.



Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13820
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13822
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366

Modified: gnucash/trunk/lib/libqof/qof/qofmath128.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofmath128.c	2007-01-02 18:00:13 UTC (rev 15302)
+++ gnucash/trunk/lib/libqof/qof/qofmath128.c	2007-01-02 18:37:16 UTC (rev 15303)
@@ -329,10 +329,22 @@
 
 
 #ifdef TEST_128_BIT_MULT
+
+#ifdef HAVE_SCANF_LLD
+#define LLX "%llx"
+#elif HAVE_SCANF_QD
+#define LLX "%qx"
+#elif HAVE_SCANF_I64D
+#define LLX "%I64x"
+#else
+#error "Unknown 64-bit Hex code"
+#endif
+
 static void pr (gint64 a, gint64 b)
 {
    qofint128 prod = mult128 (a,b);
-   printf ("%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT " = %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " (0x%llx %llx) %hd\n",
+   printf ("%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT " = %"
+	   G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " (0x" LLX " " LLX ") %hd\n",
 	   a, b, prod.hi, prod.lo, prod.hi, prod.lo, prod.isbig);
 }
 
@@ -341,7 +353,9 @@
    qofint128 prod = mult128 (a,b);
    qofint128 quot = div128 (prod, c);
    gint64 rem = rem128 (prod, c);
-   printf ("%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT " / %" G_GINT64_FORMAT " = %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " + %" G_GINT64_FORMAT " (0x%llx %llx) %hd\n",
+   printf ("%" G_GINT64_FORMAT " * %" G_GINT64_FORMAT " / %" G_GINT64_FORMAT
+	   " = %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " + %"
+	   G_GINT64_FORMAT " (0x" LLX " " LLX ") %hd\n",
 	   a, b, c, quot.hi, quot.lo, rem, quot.hi, quot.lo, quot.isbig);
 }
 
@@ -398,7 +412,7 @@
   for (i=0; i<20; i++) {
 
   quot = div128 (n, d);
-  printf ("%d result = %llx %llx\n", i, quot.hi, quot.lo);
+  printf ("%d result = " LLX " " LLX "\n", i, quot.hi, quot.lo);
     d >>=1;
     n = shift128 (n);
   }



More information about the gnucash-changes mailing list