diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2015-12-17 19:50:46 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2015-12-17 19:50:46 +0000 |
commit | 7e75fa79b2e76251c2cd417a7eae8a7620b014ae (patch) | |
tree | ae9ec3684edbea3125b046b924dfda14d60031db /lib/Core/Memory.cpp | |
parent | 901bd2c429ac51dd143a2a4bfc07c382dfb21e72 (diff) | |
download | klee-7e75fa79b2e76251c2cd417a7eae8a7620b014ae.tar.gz |
Clean up the check in the previous commit by using one of KLEE's
helper functions.
Diffstat (limited to 'lib/Core/Memory.cpp')
-rw-r--r-- | lib/Core/Memory.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp index 47bc7576..12ca7104 100644 --- a/lib/Core/Memory.cpp +++ b/lib/Core/Memory.cpp @@ -529,10 +529,7 @@ void ObjectState::write(unsigned offset, ref<Expr> value) { // Check for writes of constant values. if (ConstantExpr *CE = dyn_cast<ConstantExpr>(value)) { Expr::Width w = CE->getWidth(); - //assuming width can't be 0 so I can miss half of power of two check - assert(w > 0); - //also checks that w is a power of two - if (w <= 64 && !(w & (w - 1))) { + if (w <= 64 && klee::bits64::isPowerOfTwo(w)) { uint64_t val = CE->getZExtValue(); switch (w) { default: assert(0 && "Invalid write size!"); |