Changes in directory llvm/lib/ExecutionEngine/Interpreter:
Interpreter.h updated: 1.80 -> 1.81 --- Log message: Add an inline helper function that masks a GenericValue to a specified bit width. --- Diffs of the changes: (+12 -0) Interpreter.h | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.80 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.81 --- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.80 Fri Jan 12 01:05:13 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h Wed Jan 17 20:12:10 2007 @@ -231,8 +231,20 @@ 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 _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits