Make `lbool` explicitly signed

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
50ffa10848/lib/bill/bill/sat/interface/abc_bsat2.hpp (L156)
for an example of that.
This commit is contained in:
Robert O'Callahan 2024-06-28 01:07:10 +00:00
parent 2d70debd07
commit 6c6260465e
1 changed files with 3 additions and 1 deletions

View File

@ -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;