Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Makefile.PL b/Makefile.PL
- index 0e76ee4..53b736b 100644
- --- a/Makefile.PL
- +++ b/Makefile.PL
- @@ -52,5 +52,12 @@ sub const_cccmd {
- $inherited .= ' -o $@';
- }
- + if ($Config{use64bitint}) {
- + $inherited .= ' -DUSE64BITINT';
- + }
- + else {
- + $inherited .= ' ';
- + }
- +
- return $inherited;
- }
- diff --git a/perl_mongo.c b/perl_mongo.c
- index 9ca1e45..4f1791c 100644
- --- a/perl_mongo.c
- +++ b/perl_mongo.c
- @@ -1032,9 +1032,15 @@ append_sv (buffer *buf, const char *key, SV *sv, AV *ids)
- case SVt_PVIV:
- case SVt_PVLV: {
- if (SvIOK(sv)) {
- - set_type(buf, BSON_INT);
- - perl_mongo_serialize_key(buf, key, ids);
- - perl_mongo_serialize_int(buf, (int)SvIV (sv));
- + #ifdef USE64BITINT
- + set_type(buf, BSON_LONG);
- + perl_mongo_serialize_key(buf, key, ids);
- + perl_mongo_serialize_long(buf, (int64_t)SvIV (sv));
- + #else
- + set_type(buf, BSON_INT);
- + perl_mongo_serialize_key(buf, key, ids);
- + perl_mongo_serialize_int(buf, (int)SvIV (sv));
- + #endif
- break;
- }
- }
- diff --git a/t/types.t b/t/types.t
- index 0db3ab0..ff9bce1 100644
- --- a/t/types.t
- +++ b/t/types.t
- @@ -20,7 +20,7 @@ if ($@) {
- plan skip_all => $@;
- }
- else {
- - plan tests => 32;
- + plan tests => 33;
- }
- my $db = $conn->get_database('x');
- @@ -170,6 +170,18 @@ isa_ok($x->{max}, 'MongoDB::MaxKey');
- $coll->save({x => 2712631400});
- $result = $coll->find_one;
- is($result->{'x'}, 2712631400);
- +
- + $coll->remove;
- +}
- +
- +SKIP: {
- + use Config;
- + skip "Skipping 64 bit native SV"
- + if ( ! $Config{use64bitint} );
- +
- + $coll->update({ x => 1 }, { '$inc' => { y => 19401194714 } }, { upsert => 1 });
- + my $result = $coll->find_one;
- + is($result->{'y'},19401194714,'64 bit ints without Math::BigInt');
- }
- END {
Add Comment
Please, Sign In to add comment