Index: src/a64/simulator-a64.h |
diff --git a/src/a64/simulator-a64.h b/src/a64/simulator-a64.h |
index 959644b773e21bec17eea32c840ebd413fc799c2..eaff71c20d669c88a8aa502c362488a18ce2ec6e 100644 |
--- a/src/a64/simulator-a64.h |
+++ b/src/a64/simulator-a64.h |
@@ -168,8 +168,14 @@ class SimRegisterBase { |
ASSERT(size <= sizeof(new_value)); |
// All AArch64 registers are zero-extending; Writing a W register clears the |
// top bits of the corresponding X register. |
- memset(value_, 0, kSizeInBytes); |
- memcpy(value_, &new_value, size); |
+ if (size == kXRegSize) { |
Rodolph Perfetta
2014/03/20 11:33:57
STATIC_ASSERT(kXRegSize == kDRegSize);
This is mo
Fritz
2014/03/20 19:37:01
Done.
|
+ memcpy(value_, &new_value, kXRegSize); |
+ } else if (size == kWRegSize) { |
+ memset(value_, 0, kSizeInBytes); |
+ memcpy(value_, &new_value, kWRegSize); |
+ } else { |
+ UNREACHABLE(); |
+ } |
} |
// Copy 'size' bytes of the register to the result, and zero-extend to fill |
@@ -179,7 +185,13 @@ class SimRegisterBase { |
ASSERT(size <= kSizeInBytes); |
T result; |
memset(&result, 0, sizeof(result)); |
Sven Panne
2014/03/20 10:22:38
I think this could be moved into the 2nd case, jus
Fritz
2014/03/20 19:37:01
Done.
|
- memcpy(&result, value_, size); |
+ if (size == kXRegSize) { |
+ memcpy(&result, value_, kXRegSize); |
+ } else if (size == kWRegSize) { |
+ memcpy(&result, value_, kWRegSize); |
+ } else { |
+ UNREACHABLE(); |
+ } |
return result; |
} |