summaryrefslogtreecommitdiff
path: root/lib/sail.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sail.c')
-rw-r--r--lib/sail.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/sail.c b/lib/sail.c
index 4e033c2a..b41cacd3 100644
--- a/lib/sail.c
+++ b/lib/sail.c
@@ -35,7 +35,7 @@ void cleanup_library(void)
mpq_clear(sail_lib_tmp_real);
}
-bool eq_unit(const unit a, const unit b)
+bool EQUAL(unit)(const unit a, const unit b)
{
return true;
}
@@ -63,7 +63,7 @@ bool not(const bool b) {
return !b;
}
-bool eq_bool(const bool a, const bool b) {
+bool EQUAL(bool)(const bool a, const bool b) {
return a == b;
}
@@ -117,6 +117,11 @@ bool eq_string(const sail_string str1, const sail_string str2)
return strcmp(str1, str2) == 0;
}
+bool EQUAL(sail_string)(const sail_string str1, const sail_string str2)
+{
+ return strcmp(str1, str2) == 0;
+}
+
void undefined_string(sail_string *str, const unit u) {}
void concat_str(sail_string *stro, const sail_string str1, const sail_string str2)
@@ -198,6 +203,12 @@ bool eq_int(const sail_int op1, const sail_int op2)
}
inline
+bool EQUAL(sail_int)(const sail_int op1, const sail_int op2)
+{
+ return !abs(mpz_cmp(op1, op2));
+}
+
+inline
bool lt(const sail_int op1, const sail_int op2)
{
return mpz_cmp(op1, op2) < 0;
@@ -533,6 +544,11 @@ bool eq_bits(const sail_bits op1, const sail_bits op2)
return true;
}
+bool EQUAL(sail_bits)(const sail_bits op1, const sail_bits op2)
+{
+ return eq_bits(op1, op2);
+}
+
bool neq_bits(const sail_bits op1, const sail_bits op2)
{
assert(op1.len == op2.len);
@@ -928,7 +944,7 @@ void to_real(real *rop, const sail_int op)
mpq_canonicalize(*rop);
}
-bool eq_real(const real op1, const real op2)
+bool EQUAL(real)(const real op1, const real op2)
{
return mpq_cmp(op1, op2) == 0;
}