Skip to content

Commit

Permalink
Make lbool explicitly signed
Browse files Browse the repository at this point in the history
This avoids issues due to some platforms making `char` signed and others
unsigned. For example, currently the result of promoting `(lbool)-1` to `int`
can differ on different platforms. See
https://github.com/lsils/mockturtle/blob/50ffa108484ba65b44eee4a713832b7ee821d6d8/lib/bill/bill/sat/interface/abc_bsat2.hpp#L156
for an example of that.
  • Loading branch information
rocallahan committed Jun 28, 2024
1 parent 2d70deb commit 6c62604
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sat/bsat/satVec.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ static inline void vecp_remove(vecp* v, void* e)
typedef int lit;
typedef int cla;

typedef char lbool;
// Explicitly make it signed so promotion-to-int behavior doesn't vary
// across platforms that define signedness of char differently.
typedef signed char lbool;

static const int var_Undef = -1;
static const lit lit_Undef = -2;
Expand Down

0 comments on commit 6c62604

Please sign in to comment.