about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2012-04-07 01:48:51 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2012-04-07 01:48:51 +0000
commit16c771d54330d73cc66b52922f37a4b6755d04b0 (patch)
treeec3910508dd750159b39107ea3f26a59ac4e8b68
parent3156f593e4198a6be6406aaf6bbb5cfcb6de860e (diff)
downloadklee-16c771d54330d73cc66b52922f37a4b6755d04b0.tar.gz
Fix ConstantExpr::is{Zero,One,AllOnes} for arbitrary bitwidths.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@154245 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/klee/Expr.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/include/klee/Expr.h b/include/klee/Expr.h
index 3e296934..09b288a8 100644
--- a/include/klee/Expr.h
+++ b/include/klee/Expr.h
@@ -391,10 +391,10 @@ public:
   /* Utility Functions */
 
   /// isZero - Is this a constant zero.
-  bool isZero() const { return getZExtValue() == 0; }
+  bool isZero() const { return getAPValue().isMinValue(); }
 
   /// isOne - Is this a constant one.
-  bool isOne() const { return getZExtValue() == 1; }
+  bool isOne() const { return getLimitedValue() == 1; }
   
   /// isTrue - Is this the true expression.
   bool isTrue() const { 
@@ -407,9 +407,7 @@ public:
   }
 
   /// isAllOnes - Is this constant all ones.
-  bool isAllOnes() const {
-    return getZExtValue(getWidth()) == bits64::maxValueOfNBits(getWidth());
-  }
+  bool isAllOnes() const { return getAPValue().isAllOnesValue(); }
 
   /* Constant Operations */