From 6692b038c7524e8b26fa4bb1266247e40b4112ab Mon Sep 17 00:00:00 2001 From: Jukka Jylänki Date: Fri, 24 Jan 2014 16:17:13 +0200 Subject: Don't use the ambiguous pow symbol since it confuses Visual Studio, instead generate bit masks with shifting. --- lib/Target/JSBackend/JSBackend.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/Target/JSBackend/JSBackend.cpp') diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 51f7488f97..137001fcb6 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -963,6 +963,10 @@ bool JSWriter::generateSIMDInstruction(const std::string &iName, const Instructi return false; } +uint64_t LSBMask(unsigned numBits) { + return numBits >= 64 ? 0xFFFFFFFFFFFFFFFFULL : (1ULL << numBits) - 1; +} + // generateInstruction - This member is called for each Instruction in a function. void JSWriter::generateInstruction(const Instruction *I, raw_string_ostream& Code) { std::string iName(getJSName(I)); @@ -1206,7 +1210,7 @@ void JSWriter::generateInstruction(const Instruction *I, raw_string_ostream& Cod case Instruction::Trunc: { //unsigned inBits = V->getType()->getIntegerBitWidth(); unsigned outBits = I->getType()->getIntegerBitWidth(); - Code << getValueAsStr(I->getOperand(0)) + "&" + utostr(pow(2, outBits)-1); + Code << getValueAsStr(I->getOperand(0)) + "&" + utostr(LSBMask(outBits)); break; } case Instruction::SExt: { -- cgit v1.2.3-18-g5258