From 648f3ed8e838976b14cf7452870bef4a56c9a6fe Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Wed, 24 Oct 2012 15:22:59 +0000 Subject: Patch by Dan Liew improving the description of getZExtValue (see discussion at http://keeda.stanford.edu/pipermail/klee-dev/2012-September/000928.html) git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@166573 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/klee/Expr.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/klee/Expr.h b/include/klee/Expr.h index 5888d4d6..9d170dc5 100644 --- a/include/klee/Expr.h +++ b/include/klee/Expr.h @@ -326,10 +326,15 @@ public: /// native ConstantExpr APIs. const llvm::APInt &getAPValue() const { return value; } - /// getZExtValue - Return the constant value for a limited number of bits. + /// getZExtValue - Returns the constant value zero extended to the + /// return type of this method. /// - /// This routine should be used in situations where the width of the constant - /// is known to be limited to a certain number of bits. + ///\param bits - optional parameter that can be used to check that the + ///number of bits used by this constant is <= to the parameter + ///value. This is useful for checking that type casts won't truncate + ///useful bits. + /// + /// Example: unit8_t byte= (unit8_t) constant->getZExtValue(8); uint64_t getZExtValue(unsigned bits = 64) const { assert(getWidth() <= bits && "Value may be out of range!"); return value.getZExtValue(); -- cgit 1.4.1