diff options
Diffstat (limited to 'lib/ExecutionEngine/Interpreter')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Interpreter.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h index c62249b..3007b0a 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.h +++ b/lib/ExecutionEngine/Interpreter/Interpreter.h @@ -231,8 +231,20 @@ private: // Helper functions GenericValue executeCastOperation(Instruction::CastOps opcode, Value *SrcVal, const Type *Ty, ExecutionContext &SF); void popStackAndReturnValueToCaller(const Type *RetTy, GenericValue Result); + }; +inline void maskToBitWidth(GenericValue& GV, unsigned BitWidth) { + uint64_t BitMask = (1ull << BitWidth) - 1; + if (BitWidth <= 8) + GV.Int8Val &= BitMask; + else if (BitWidth <= 16) + GV.Int16Val &= BitMask; + else if (BitWidth <= 32) + GV.Int32Val &= BitMask; + else + GV.Int64Val &= BitMask; +} } // End llvm namespace #endif |