Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/27228 )

Change subject: sim: Simplify collecting the key value in initParam.
......................................................................

sim: Simplify collecting the key value in initParam.

If the first register is all zeroes, it doesn't really matter what the
other register is. If the first register has the entire string, we still
don't care what the other register has in it. There's no reason to
complicate the code with these extra checks.

Change-Id: I22ad521b9ace915ccb75f15934fc6b3d650d5293
---
M src/sim/pseudo_inst.cc
1 file changed, 2 insertions(+), 11 deletions(-)



diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index e307387..28d032c 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -259,18 +259,9 @@
     const int len = 2 * sizeof(uint64_t) + 1;
     char key_str[len];
     memset(key_str, '\0', len);
-    if (key_str1 == 0) {
-        assert(key_str2 == 0);
-    } else {
-        strncpy(key_str, (char *)&key_str1, sizeof(uint64_t));
-    }

-    if (strlen(key_str) == sizeof(uint64_t)) {
-        strncpy(key_str + sizeof(uint64_t), (char *)&key_str2,
-                sizeof(uint64_t));
-    } else {
-        assert(key_str2 == 0);
-    }
+    memcpy(key_str, (char *)&key_str1, sizeof(key_str1));
+ memcpy(key_str + sizeof(uint64_t), (char *)&key_str2, sizeof(key_str2));

     // Compare the key parameter with the known values to select the return
     // value

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/27228
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I22ad521b9ace915ccb75f15934fc6b3d650d5293
Gerrit-Change-Number: 27228
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to