summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-10-29 02:27:24 +0000
committerPádraig Brady <P@draigBrady.com>2012-11-04 00:49:04 +0000
commit5e9401800b186a3746e3b50981ac11b709d3742a (patch)
tree5d423160df324b5a7e07fb84d4957481386ba328
parentad5eeacc6740fd98ebe641b6fa88ec4019295b4e (diff)
downloadcoreutils-5e9401800b186a3746e3b50981ac11b709d3742a.tar.xz
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.
-rw-r--r--src/make-prime-list.c9
1 files 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 <config.h>
#include <stdint.h>
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -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;
}