about summary refs log tree commit diff homepage
path: root/lib/Expr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Expr')
-rw-r--r--lib/Expr/Expr.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 2026a07b..7feba8ab 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -363,19 +363,7 @@ ref<Expr> ConstantExpr::fromMemory(void *address, Width width) {
 
 void ConstantExpr::toMemory(void *address) {
   auto width = getWidth();
-  switch (width) {
-  default: assert(0 && "invalid type");
-  case  Expr::Bool: *(( uint8_t*) address) = getZExtValue(1); break;
-  case  Expr::Int8: *(( uint8_t*) address) = getZExtValue(8); break;
-  case Expr::Int16: *((uint16_t*) address) = getZExtValue(16); break;
-  case Expr::Int32: *((uint32_t*) address) = getZExtValue(32); break;
-  case Expr::Int64: *((uint64_t*) address) = getZExtValue(64); break;
-  case Expr::Fl80:
-  case Expr::Int128:
-  case Expr::Int256:
-  case Expr::Int512:
-      std::memcpy(address, value.getRawData(), width / 8);
-  }
+  std::memcpy(address, value.getRawData(), (width + 7) / 8);
 }
 
 void ConstantExpr::toString(std::string &Res, unsigned radix) const {