Skip to content

Commit

Permalink
goto-instrument/wmm: explicit conversion of bool to 0/1
Browse files Browse the repository at this point in the history
bool may convert to a signed or unsigned int depending on the implementation.
  • Loading branch information
tautschnig committed Jul 8, 2018
1 parent d393d1c commit 5953f6a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/goto-instrument/wmm/abstract_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,15 @@ class abstract_eventt:public graph_nodet<empty_edget>

unsigned char fence_value() const
{
unsigned char value = WRfence + 2*WWfence + 4*RRfence + 8*RWfence
+ 16*WWcumul + 32*RWcumul + 64*RRcumul;
return value;
return uc(WRfence) + 2u * uc(WWfence) + 4u * uc(RRfence) +
8u * uc(RWfence) + 16u * uc(WWcumul) + 32u * uc(RWcumul) +
64u * uc(RRcumul);
}

private:
static unsigned char uc(bool truth_value)
{
return truth_value ? 1u : 0u;
}
};

Expand Down

0 comments on commit 5953f6a

Please sign in to comment.