about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-22 03:41:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-22 03:41:57 +0000
commit11d1cbae8f642953c5d60faa9a02c9630930461b (patch)
tree0a7e280a76cd59d1d619d6059eba0a0e3fed5632
parent93109234b9e7c5ba50441bbfab3dad02a77f8787 (diff)
downloadklee-11d1cbae8f642953c5d60faa9a02c9630930461b.tar.gz
Remove unnecessary width field, the width is part of the APInt.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73872 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/klee/Expr.h10
-rw-r--r--lib/Expr/Expr.cpp4
2 files changed, 6 insertions, 8 deletions
diff --git a/include/klee/Expr.h b/include/klee/Expr.h
index 49d612cc..fea269e8 100644
--- a/include/klee/Expr.h
+++ b/include/klee/Expr.h
@@ -299,15 +299,12 @@ public:
 private:
   llvm::APInt value;
 
-  ConstantExpr(uint64_t v, Width w) : value(w, v), width(w) {}
-
-public:
-  Width width;
+  ConstantExpr(uint64_t v, Width w) : value(w, v) {}
 
 public:
   ~ConstantExpr() {};
   
-  Width getWidth() const { return width; }
+  Width getWidth() const { return value.getBitWidth(); }
   Kind getKind() const { return Constant; }
 
   unsigned getNumKids() const { return 0; }
@@ -335,7 +332,8 @@ public:
  
   int compareContents(const Expr &b) const { 
     const ConstantExpr &cb = static_cast<const ConstantExpr&>(b);
-    if (width != cb.width) return width < cb.width ? -1 : 1;
+    if (getWidth() != cb.getWidth()) 
+      return getWidth() < cb.getWidth() ? -1 : 1;
     if (value == cb.value)
       return 0;
     return value.ult(cb.value) ? -1 : 1;
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 2d41a579..1615127a 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -164,7 +164,7 @@ unsigned Expr::computeHash() {
 }
 
 unsigned ConstantExpr::computeHash() {
-  hashValue = getConstantValue() ^ (width * MAGIC_HASH_CONSTANT);
+  hashValue = getConstantValue() ^ (getWidth() * MAGIC_HASH_CONSTANT);
   return hashValue;
 }
 
@@ -336,7 +336,7 @@ ref<Expr> ConstantExpr::fromMemory(void *address, Width width) {
 }
 
 void ConstantExpr::toMemory(void *address) {
-  switch (width) {
+  switch (getWidth()) {
   default: assert(0 && "invalid type");
   case  Expr::Bool: *(( uint8_t*) address) = getConstantValue(); break;
   case  Expr::Int8: *(( uint8_t*) address) = getConstantValue(); break;