From: Jarkko Hietaniemi Date: Mon, 2 Aug 1999 11:22:19 +0000 (+0000) Subject: Fix printf %D %U %O for quads. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=29fe7a80153b6d2e749a8f652a3275fb1d6538a5;p=p5sagit%2Fp5-mst-13.2.git Fix printf %D %U %O for quads. p4raw-id: //depot/cfgperl@3882 --- diff --git a/sv.c b/sv.c index 2257516..1b15240 100644 --- a/sv.c +++ b/sv.c @@ -4925,7 +4925,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV goto integer; case 'D': +#ifdef IV_IS_QUAD + /* nothing */ +#else intsize = 'l'; +#endif /* FALL THROUGH */ case 'd': case 'i': @@ -4973,7 +4977,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV goto integer; case 'U': +#ifdef IV_IS_QUAD + /* nothing */ +#else intsize = 'l'; +#endif /* FALL THROUGH */ case 'u': base = 10; @@ -4984,7 +4992,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV goto uns_integer; case 'O': +#ifdef IV_IS_QUAD + /* nothing */ +#else intsize = 'l'; +#endif /* FALL THROUGH */ case 'o': base = 8; diff --git a/t/op/64bit.t b/t/op/64bit.t index c8da1cb..f49b5e4 100644 --- a/t/op/64bit.t +++ b/t/op/64bit.t @@ -11,7 +11,7 @@ BEGIN { # Nota bene: bit operations are not 64-bit clean. See the beginning # of pp.c and the explanation next to IBW/UBW. -print "1..27\n"; +print "1..30\n"; my $q = 12345678901; my $r = 23456789012; @@ -113,22 +113,35 @@ print "not " unless $x == $q && $x eq $q; print "ok 22\n"; +$x = sprintf("%D", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 23\n"; + +$x = sprintf("%U", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 24\n"; + +$x = sprintf("%O", $q); +print "not " unless oct($x) == $q; +print "ok 25\n"; + + $x = $q + $r; print "not " unless $x == 35802467913; -print "ok 23\n"; +print "ok 26\n"; $x = $q - $r; print "not " unless $x == -11111110111; -print "ok 24\n"; +print "ok 27\n"; $x = $q * $r; print "not " unless $x == 289589985190657035812; -print "ok 25\n"; +print "ok 28\n"; $x /= $r; print "not " unless $x == $q; -print "ok 26\n"; +print "ok 29\n"; $x = 98765432109 % 12345678901; print "not " unless $x == 901; -print "ok 27\n"; +print "ok 30\n";