Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang compatibility fixes #3

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/minisat/minisat.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static VALUE solver_add_clause_2(VALUE rslv, VALUE rcls)
}
else {
rcls = rb_convert_type(rcls, T_ARRAY, "Array", "to_ary");
return solver_add_clause(RARRAY_LEN(rcls), RARRAY_PTR(rcls), rslv);
return solver_add_clause((int) RARRAY_LEN(rcls), RARRAY_PTR(rcls), rslv);
}
}

Expand Down
12 changes: 6 additions & 6 deletions minisat/minisat/core/SolverTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ struct Lit {
int x;

// Use this as a constructor:
friend Lit mkLit(Var var, bool sign = false);
friend Lit mkLit(Var var, bool sign);

bool operator == (Lit p) const { return x == p.x; }
bool operator != (Lit p) const { return x != p.x; }
bool operator < (Lit p) const { return x < p.x; } // '<' makes p, ~p adjacent in the ordering.
};


inline Lit mkLit (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }
inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; }
inline Lit mkLit (Var var, bool sign = false) { Lit p; p.x = var + var + (int)sign; return p; }
inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; }
inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; }
inline bool sign (Lit p) { return p.x & 1; }
inline int var (Lit p) { return p.x >> 1; }

// Mapping Literals to and from compact integers suitable for array indexing:
inline int toInt (Var v) { return v; }
inline int toInt (Lit p) { return p.x; }
inline Lit toLit (int i) { Lit p; p.x = i; return p; }
inline int toInt (Var v) { return v; }
inline int toInt (Lit p) { return p.x; }
inline Lit toLit (int i) { Lit p; p.x = i; return p; }

//const Lit lit_Undef = mkLit(var_Undef, false); // }- Useful special constants.
//const Lit lit_Error = mkLit(var_Undef, true ); // }
Expand Down
2 changes: 1 addition & 1 deletion minisat/minisat/utils/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class IntOption : public Option
return false;

char* end;
int32_t tmp = strtol(span, &end, 10);
int32_t tmp = (int32_t) strtol(span, &end, 10);

if (end == NULL)
return false;
Expand Down