summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-08-01 22:22:51 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-08-01 22:22:51 +0000
commitcf2093f6405d08be483e037b6052608c46952a75 (patch)
treea2572a825ae30eabcd1fee0cac65751bef6a4d05 /doio.c
parentad7e816fc202b9506cd8e0633196331ccf37f264 (diff)
downloadperl-cf2093f6405d08be483e037b6052608c46952a75.tar.gz
64-bit work. Now 32-bit platforms get a 100% make test
with -Duse64bits (using long long). Tested in Solaris 2.6 sparc RH Linux 6.0 x86 (and Digital IX 4.0D, to get a true 64-bit opinion). Now e.g. 'print unpack "q", pack "q", 12345678901' should work on such 32-bit platforms. Still a lot of printf()s behind -D which wrongly assume that %ld/%lx and (long) are a good combination. Introducing a slew of new macros intended to be used in printf() format strings: e. g. PERL_PRId64 is the string to be used when printing an IV, printf("%" PERL_PRId64 "\n", iv). The PRI... naming follows the C9X naming of <inttypes.h> macros. p4raw-id: //depot/cfgperl@3861
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 32c3a04165..47d70cd328 100644
--- a/doio.c
+++ b/doio.c
@@ -1001,10 +1001,17 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp)
if (SvIOK(sv)) {
if (SvGMAGICAL(sv))
mg_get(sv);
- if (SvIsUV(sv)) /* XXXX 64-bit? */
+#ifdef IV_IS_QUAD
+ if (SvIsUV(sv))
+ PerlIO_printf(fp, "%" PERL_PRIu64, (UV)SvUVX(sv));
+ else
+ PerlIO_printf(fp, "%" PERL_PRId64, (IV)SvIVX(sv));
+#else
+ if (SvIsUV(sv))
PerlIO_printf(fp, "%lu", (unsigned long)SvUVX(sv));
else
PerlIO_printf(fp, "%ld", (long)SvIVX(sv));
+#endif
return !PerlIO_error(fp);
}
/* FALL THROUGH */