diff options
author | David Storch <david.storch@10gen.com> | 2014-04-07 18:39:44 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-04-07 21:30:48 -0400 |
commit | 56f3a5f0f10377b8dc13a22d59b7f90bd173411f (patch) | |
tree | 1b4326ac2ab6ff26f3f6076b319b95b6232c65ec /src/mongo/scripting | |
parent | 267065628351063a6738cdba7430ab4701a74325 (diff) | |
download | mongo-56f3a5f0f10377b8dc13a22d59b7f90bd173411f.tar.gz |
SERVER-13492 fix bson template evaluator test compile on 32 bit linux
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r-- | src/mongo/scripting/bson_template_evaluator.cpp | 2 | ||||
-rw-r--r-- | src/mongo/scripting/bson_template_evaluator_test.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/scripting/bson_template_evaluator.cpp b/src/mongo/scripting/bson_template_evaluator.cpp index 038ab4582fd..a76531c8621 100644 --- a/src/mongo/scripting/bson_template_evaluator.cpp +++ b/src/mongo/scripting/bson_template_evaluator.cpp @@ -153,7 +153,7 @@ namespace mongo { // high order byte. if (!spec["unique"].eoo() && spec["unique"].trueValue()) { long long workerid = btl->_id; - curr_seqval += (workerid << (64-8)); + curr_seqval += (workerid << ((sizeof(long long) - 1) * 8)); } if (btl->_seqIdMap.end() != btl->_seqIdMap.find(seq_id)) { diff --git a/src/mongo/scripting/bson_template_evaluator_test.cpp b/src/mongo/scripting/bson_template_evaluator_test.cpp index 3248881a61b..905a32f8911 100644 --- a/src/mongo/scripting/bson_template_evaluator_test.cpp +++ b/src/mongo/scripting/bson_template_evaluator_test.cpp @@ -270,7 +270,8 @@ namespace mongo { // Test that the 'unique: true' option correctly puts the ID of the // bson template evaluator into the high order byte of a 64 bit integer. - t->setId(9); + long long evaluatorId = 9; + t->setId(evaluatorId); seqObj1 = BSON( "#SEQ_INT" << BSON( "seq_id" << 4 << "start" << 8 << "step" << 1 )); seqObj2 = BSON( "#SEQ_INT" @@ -289,7 +290,7 @@ namespace mongo { ASSERT_EQUALS( BsonTemplateEvaluator::StatusSuccess, t->evaluate(BSON("seqField" << seqObj2), builder12) ); // The template evaluator id of 9 goes in the high-order byte. - long long expectedSeqNum = 0x0900000000000008; + long long expectedSeqNum = (evaluatorId << ((sizeof(long long) - 1) * 8)) + 8; expectedObj = BSON("seqField" << expectedSeqNum); ASSERT_EQUALS(0, expectedObj.woCompare(builder12.obj())); |