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

Change subject: ext: Fix an operator precedence bug in the nomali library.
......................................................................

ext: Fix an operator precedence bug in the nomali library.

An expression in that library intended to create a bitmask by checking
if a bit should be set, and then using ?: to select between a bitmask
with that bit, or 0. Unfortunately | is higher precedence than ?:, and
so 0 would be |-ed with the condition of the next ?: instead. This CL
fixes the bug by adding some parenthesis.

Change-Id: Ib7e06f261e07a6ad00b9a96939d07b64c3a50409
---
M ext/nomali/lib/jobcontrol.cc
1 file changed, 2 insertions(+), 2 deletions(-)



diff --git a/ext/nomali/lib/jobcontrol.cc b/ext/nomali/lib/jobcontrol.cc
index 558cf3a..c62cd3d 100644
--- a/ext/nomali/lib/jobcontrol.cc
+++ b/ext/nomali/lib/jobcontrol.cc
@@ -132,8 +132,8 @@
     for (int i = 0; i < 16; ++i) {
         const JobSlot &slot(slots[i]);
         if (jobs & (1 << i)) {
-            js_state |= slot.active() ? (1 << i) : 0 |
-                slot.activeNext() ? (0x10000 << i) : 0;
+            js_state |= (slot.active() ? (1 << i) : 0) |
+                (slot.activeNext() ? (0x10000 << i) : 0);
         }
     }
     regs[RegAddr(JOB_IRQ_JS_STATE)] = js_state;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40954
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: Ib7e06f261e07a6ad00b9a96939d07b64c3a50409
Gerrit-Change-Number: 40954
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to