Merge remote branch 'upstream/master' into perl5-directors-minimal

This commit is contained in:
Robert Stone 2013-11-16 12:06:34 -08:00
commit bb6ab0318c
2 changed files with 17 additions and 12 deletions

View file

@ -41,8 +41,8 @@ batch('schar', -0x80, 0, 1, 12, 0x7f);
use Math::BigInt qw(); use Math::BigInt qw();
# the pack dance is to get plain old NVs out of the # the pack dance is to get plain old NVs out of the
# Math::BigInt objects. # Math::BigInt objects.
my $inf = unpack 'd', pack 'd', Math::BigInt->binf(); my $inf = unpack 'd', pack 'd', Math::BigInt->new('Inf');
my $nan = unpack 'd', pack 'd', Math::BigInt->bnan(); my $nan = unpack 'd', pack 'd', Math::BigInt->new('NaN');
batch('float', batch('float',
-(2 - 2 ** -23) * 2 ** 127, -(2 - 2 ** -23) * 2 ** 127,
-1, -2 ** -149, 0, 2 ** -149, 1, -1, -2 ** -149, 0, 2 ** -149, 1,
@ -63,12 +63,16 @@ batch('schar', -0x80, 0, 1, 12, 0x7f);
batch('longlong', -1, 0, 1, 12); batch('longlong', -1, 0, 1, 12);
batch('ulonglong', 0, 1, 12); batch('ulonglong', 0, 1, 12);
SKIP: { SKIP: {
my $a = "8000000000000000"; use Math::BigInt qw();
my $b = "7fffffffffffffff";
my $c = "ffffffffffffffff";
skip "not a 64bit Perl", 18 unless eval { pack 'q', 1 }; skip "not a 64bit Perl", 18 unless eval { pack 'q', 1 };
batch('longlong', -hex($a), hex($b)); my $a = unpack 'q', pack 'q',
batch('ulonglong', hex($c)); Math::BigInt->new('-9223372036854775808');
my $b = unpack 'q', pack 'q',
Math::BigInt->new('9223372036854775807');
my $c = unpack 'Q', pack 'Q',
Math::BigInt->new('18446744073709551615');
batch('longlong', $a, $b);
batch('ulonglong', $c);
} }
my($foo, $int) = li_typemaps::out_foo(10); my($foo, $int) = li_typemaps::out_foo(10);

View file

@ -53,12 +53,13 @@ $cvar->{var_unsigned_long} = createref_unsigned_long(10);
is(value_unsigned_long($cvar->{var_unsigned_long}), 10); is(value_unsigned_long($cvar->{var_unsigned_long}), 10);
SKIP: { SKIP: {
my $a = "6FFFFFFFFFFFFFF8"; use Math::BigInt qw();
skip "64 bit int support", 1 unless eval { pack 'q', 1 }; skip "64 bit int support", 1 unless eval { pack 'q', 1 };
# using hex() here instead of a literal because non 64bit Perls will # the pack dance is to get plain old IVs out of the
# be noisy about big constants. # Math::BigInt objects.
$cvar->{var_long_long} = createref_long_long(hex $a); my $a = unpack 'q', pack 'q', Math::BigInt->new('8070450532247928824');
is(value_long_long($cvar->{var_long_long}), hex $a); $cvar->{var_long_long} = createref_long_long($a);
is(value_long_long($cvar->{var_long_long}), $a);
} }
#ull = abs(0xFFFFFFF2FFFFFFF0) #ull = abs(0xFFFFFFF2FFFFFFF0)