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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27228
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
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