diff options
author | Drew Paroski <drew.paroski@mongodb.com> | 2020-10-07 19:04:32 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-10-08 09:54:42 +0000 |
commit | 013c3f1bed2d31995bb1ca041b41b27496e0b1a7 (patch) | |
tree | 71f18f84e749f58819b4c36af66e6551adc958d5 /src/mongo/db/exec/sbe/expressions/expression.cpp | |
parent | b2429fa83457d26135a10a2d70a2c554c61922f7 (diff) | |
download | mongo-013c3f1bed2d31995bb1ca041b41b27496e0b1a7.tar.gz |
SERVER-50594 [SBE] Fix bool/int32_t issue on big-endian systems
Diffstat (limited to 'src/mongo/db/exec/sbe/expressions/expression.cpp')
-rw-r--r-- | src/mongo/db/exec/sbe/expressions/expression.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/exec/sbe/expressions/expression.cpp b/src/mongo/db/exec/sbe/expressions/expression.cpp index b4e010ba383..b752de92e2d 100644 --- a/src/mongo/db/exec/sbe/expressions/expression.cpp +++ b/src/mongo/db/exec/sbe/expressions/expression.cpp @@ -183,7 +183,8 @@ std::unique_ptr<vm::CodeFragment> EPrimBinary::compile(CompileCtx& ctx) const { break; case EPrimBinary::logicAnd: { auto codeFalseBranch = std::make_unique<vm::CodeFragment>(); - codeFalseBranch->appendConstVal(value::TypeTags::Boolean, false); + codeFalseBranch->appendConstVal(value::TypeTags::Boolean, + value::bitcastFrom<bool>(false)); // Jump to the merge point that will be right after the thenBranch (rhs). codeFalseBranch->appendJump(rhs->instrs().size()); @@ -198,7 +199,8 @@ std::unique_ptr<vm::CodeFragment> EPrimBinary::compile(CompileCtx& ctx) const { } case EPrimBinary::logicOr: { auto codeTrueBranch = std::make_unique<vm::CodeFragment>(); - codeTrueBranch->appendConstVal(value::TypeTags::Boolean, true); + codeTrueBranch->appendConstVal(value::TypeTags::Boolean, + value::bitcastFrom<bool>(true)); // Jump to the merge point that will be right after the thenBranch (true branch). rhs->appendJump(codeTrueBranch->instrs().size()); @@ -633,9 +635,10 @@ std::unique_ptr<vm::CodeFragment> EFail::compile(CompileCtx& ctx) const { auto code = std::make_unique<vm::CodeFragment>(); code->appendConstVal(value::TypeTags::NumberInt64, - value::bitcastFrom(static_cast<int64_t>(_code))); + value::bitcastFrom<int64_t>(static_cast<int64_t>(_code))); - code->appendConstVal(value::TypeTags::StringBig, value::bitcastFrom(_message.c_str())); + code->appendConstVal(value::TypeTags::StringBig, + value::bitcastFrom<const char*>(_message.c_str())); code->appendFail(); |