From 5e9401800b186a3746e3b50981ac11b709d3742a Mon Sep 17 00:00:00 2001
From: Pádraig Brady
Date: Mon, 29 Oct 2012 02:27:24 +0000
Subject: build: don't rely on support for '%*j' printf format
* src/make-prime-list.c: Hardcode the uintmax_t width
to 16 hex digits (64 bit), to avoid this compile issue
on HPUS systems at least.
---
src/make-prime-list.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/make-prime-list.c b/src/make-prime-list.c
index e0d9b810e..98eef8f59 100644
--- a/src/make-prime-list.c
+++ b/src/make-prime-list.c
@@ -20,6 +20,7 @@ this program. If not, see http://www.gnu.org/licenses/. */
#include
#include
+#include
#include
#include
#include
@@ -77,17 +78,15 @@ output_primes (const struct prime *primes, unsigned nprimes)
exit (EXIT_FAILURE);
}
-#define SZ (int)(2*sizeof (uintmax_t))
-
for (i = 0, p = 2; i < nprimes; i++)
{
unsigned int d8 = i + 8 < nprimes ? primes[i + 8].p - primes[i].p : 0xff;
if (255 < d8) /* this happens at 668221 */
abort ();
- printf ("P (%2u, %3u, 0x%0*jx%s, 0x%0*jx%s) /* %d */\n",
+ printf ("P (%2u, %3u, 0x%016"PRIxMAX"%s, 0x%016"PRIxMAX"%s) /* %d */\n",
primes[i].p - p, d8,
- SZ, primes[i].pinv, suffix,
- SZ, primes[i].lim, suffix, primes[i].p);
+ primes[i].pinv, suffix,
+ primes[i].lim, suffix, primes[i].p);
p = primes[i].p;
}
--
cgit v1.2.3-70-g09d2