Chromium Code Reviews| Index: src/a64/instructions-a64.h |
| diff --git a/src/a64/instructions-a64.h b/src/a64/instructions-a64.h |
| index 472d4bf9fd76d367c0200f4d0b1156546f0ca34e..1d19e68a4984204b1138f719550d5e6526a6d8ea 100644 |
| --- a/src/a64/instructions-a64.h |
| +++ b/src/a64/instructions-a64.h |
| @@ -116,13 +116,11 @@ enum Reg31Mode { |
| class Instruction { |
| public: |
| Instr InstructionBits() const { |
| - Instr bits; |
| - memcpy(&bits, this, sizeof(bits)); |
|
jbramley
2014/02/19 10:12:22
These simple (fixed-size) memcpy calls should be f
|
| - return bits; |
| + return *reinterpret_cast<Instr*>(const_cast<Instruction*>(this)); |
| } |
| void SetInstructionBits(Instr new_instr) { |
| - memcpy(this, &new_instr, sizeof(new_instr)); |
| + *reinterpret_cast<Instr*>(this) = new_instr; |
| } |
| int Bit(int pos) const { |
| @@ -367,15 +365,15 @@ class Instruction { |
| uint32_t Literal32() { |
| uint32_t literal; |
| - memcpy(&literal, LiteralAddress(), sizeof(literal)); |
| - |
| + uint32_t* buffer = &literal; |
| + *buffer = *reinterpret_cast<uint32_t*>(LiteralAddress()); |
| return literal; |
| } |
| uint64_t Literal64() { |
| uint64_t literal; |
| - memcpy(&literal, LiteralAddress(), sizeof(literal)); |
| - |
| + uint64_t* buffer = &literal; |
| + *buffer = *reinterpret_cast<uint64_t*>(LiteralAddress()); |
| return literal; |
| } |