Skip to content

Commit

Permalink
Clarify intention between comparison to zero and the shift operation
Browse files Browse the repository at this point in the history
Building with (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 gives this warning

../events/equeue/equeue.c: In function 'equeue_incid':
../events/equeue/equeue.c:40:17: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
     if (!(e->id << q->npw2)) {
  • Loading branch information
Paul Thompson authored and geky committed Aug 4, 2019
1 parent 3a5c0c5 commit 95f10d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion equeue.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static inline int equeue_clampdiff(unsigned a, unsigned b) {
// Increment the unique id in an event, hiding the event from cancel
static inline void equeue_incid(equeue_t *q, struct equeue_event *e) {
e->id += 1;
if (!(e->id << q->npw2)) {
if (0 == (e->id << q->npw2)) {
e->id = 1;
}
}
Expand Down

0 comments on commit 95f10d9

Please sign in to comment.