Browse files

honor d_longlong on integer constant is too large for ‘unsigned long’…

… type
  • Loading branch information...
1 parent 1926edc commit 64852ed5dfcd36e90265301fdee795c1c390f6b0 @rurban committed Feb 20, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/B/C.pm
View
9 lib/B/C.pm
@@ -702,10 +702,13 @@ sub ivx ($) {
my $ivdformat = $Config{ivdformat};
$ivdformat =~ s/"//g; #" poor editor
my $intmax = (1 << ($Config{ivsize}*4-1)) - 1;
- # UL if > INT32_MAX = 2147483647
- my $sval = sprintf("%${ivdformat}%s", $ivx, $ivx > $intmax ? "UL" : "");
+ # LL if INT32_MAX .. INT64_MAX
+ # UL if > INT32_MAX = 2147483647
+ my $ll = $Config{d_longlong} ? "LL" : "UL";
+ my $sval = sprintf("%${ivdformat}%s", $ivx, $ivx > $intmax ? $ll : "");
if ($ivx < -$intmax) {
- $sval = sprintf("%${ivdformat}%s", $ivx, "L"); # DateTime
+ my $l = $Config{d_longlong} ? "LL" : "L";
+ $sval = sprintf("%${ivdformat}%s", $ivx, $l); # DateTime
}
$sval = '0' if $sval =~ /(NAN|inf)$/i;
return $sval;

0 comments on commit 64852ed

Please sign in to comment.