From: Jarkko Hietaniemi Date: Fri, 31 Mar 2000 18:50:54 +0000 (+0000) Subject: Fix for "[ID 20000329.080] quad printing does not work as documented", X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=686fa4bb8e88f0c9a36218cdbf3c49f4a7b93b2a;p=p5sagit%2Fp5-mst-13.2.git Fix for "[ID 20000329.080] quad printing does not work as documented", reported by Joseph N. Hall. The bug was that even with use64bitint one had to use the prefixes q, L, or ll with printf/sprintf, contrary to the documentation and common sense. p4raw-id: //depot/cfgperl@5905 --- diff --git a/sv.c b/sv.c index 3eebc9a..8f7e1f2 100644 --- a/sv.c +++ b/sv.c @@ -5926,6 +5926,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV break; } +#ifdef USE_64_BIT_INT + if (!intsize) + intsize = 'q'; +#endif + /* CONVERSION */ switch (c = *q++) { diff --git a/t/op/64bitint.t b/t/op/64bitint.t index 60f72c3..ef43ae6 100644 --- a/t/op/64bitint.t +++ b/t/op/64bitint.t @@ -10,13 +10,13 @@ BEGIN { unshift @INC, '../lib'; } -# This could use a lot of more tests. +# This could use many more tests. # so that using > 0xfffffff constants and # 32+ bit integers don't cause noise no warnings qw(overflow portable); -print "1..48\n"; +print "1.52\n"; my $q = 12345678901; my $r = 23456789012; @@ -239,4 +239,17 @@ print "ok 47\n"; print "not " unless (0xf000000000000000 ^ 0xfffffffffffffff0) == 0x0ffffffffffffff0; print "ok 48\n"; + +print "not " unless (sprintf "%b", ~0) eq '1111111111111111111111111111111111111111111111111111111111111111'; +print "ok 49\n"; + +print "not " unless (sprintf "%64b", ~0) eq '1111111111111111111111111111111111111111111111111111111111111111'; +print "ok 50\n"; + +print "not " unless (sprintf "%d", ~0>>1) eq '9223372036854775807'; +print "ok 51\n"; + +print "not " unless (sprintf "%u", ~0) eq '18446744073709551615'; +print "ok 52\n"; + # eof