[Beignet] [PATCH 08/12] gbe/ir: initialize the InstructionBase by a straightforward way.

xionghu.luo at intel.com xionghu.luo at intel.com
Thu May 5 16:11:51 UTC 2016


From: Luo Xionghu <xionghu.luo at intel.com>

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 backend/src/ir/instruction.hpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/backend/src/ir/instruction.hpp b/backend/src/ir/instruction.hpp
index 9cc926d..bbdef91 100644
--- a/backend/src/ir/instruction.hpp
+++ b/backend/src/ir/instruction.hpp
@@ -134,10 +134,10 @@ namespace ir {
   {
   public:
     /*! Initialize the instruction from a 8 bytes stream */
-    INLINE InstructionBase(const char *stream) {
-      opcode = Opcode(stream[0]);
+    INLINE InstructionBase(Opcode op, const char* opaque) {
+      opcode = op;
       for (uint32_t byte = 0; byte < opaqueSize; ++byte)
-        opaque[byte] = stream[byte+1];
+        this->opaque[byte] = opaque[byte];
     }
     /*! Uninitialized instruction */
     INLINE InstructionBase(void) {}
@@ -155,12 +155,12 @@ namespace ir {
   {
   public:
     /*! Initialize the instruction from a 8 bytes stream */
-    INLINE Instruction(const char *stream) : InstructionBase(stream) {
+    INLINE Instruction(const char *stream) : InstructionBase(Opcode(stream[0]), &stream[1]) {
       parent = NULL;
     }
     /*! Copy the private fields and give it the same parent */
     INLINE Instruction(const Instruction &other) :
-      InstructionBase(reinterpret_cast<const char*>(&other.opcode)) {
+      InstructionBase(other.opcode, other.opaque) {
       parent = other.parent;
     }
 
-- 
2.1.4



More information about the Beignet mailing list