Skip to content

Commit

Permalink
static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobR committed Jul 27, 2023
1 parent 8b9d9db commit cd37352
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/util/sat_literal.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ namespace sat {
class literal {
unsigned m_val;
public:
constexpr literal(): m_val(null_bool_var << 1) {
#ifdef Z3DEBUG
assert(var() == null_bool_var);
assert(!sign());
#endif
}
constexpr literal(): m_val(null_bool_var << 1) { }

explicit literal(bool_var v, bool _sign = false):
m_val((v << 1) + static_cast<unsigned>(_sign)) {
Expand Down Expand Up @@ -90,6 +85,9 @@ namespace sat {
};

inline constexpr literal null_literal;
static_assert(null_literal.var() == null_bool_var);
static_assert(!null_literal.sign());

using literal_hash = obj_hash<literal>;

inline literal to_literal(unsigned x) { literal l; l.m_val = x; return l; }
Expand Down

0 comments on commit cd37352

Please sign in to comment.