|
@@ -36,6 +36,7 @@
|
|
|
* num_lesser_equal(string n1, string n2)
|
|
* num_lesser_equal(string n1, string n2)
|
|
|
* num_greater_equal(string n1, string n2)
|
|
* num_greater_equal(string n1, string n2)
|
|
|
* num_equal(string n1, string n2)
|
|
* num_equal(string n1, string n2)
|
|
|
|
|
+ * num_different(string n1, string n2)
|
|
|
*
|
|
*
|
|
|
* Variables:
|
|
* Variables:
|
|
|
* (empty) - "true" or "false", reflecting the value of the relation in question
|
|
* (empty) - "true" or "false", reflecting the value of the relation in question
|
|
@@ -112,6 +113,12 @@ static int compute_equal (NCDModuleInst *i, uintmax_t n1, uintmax_t n2, char *ou
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static int compute_different (NCDModuleInst *i, uintmax_t n1, uintmax_t n2, char *out_str)
|
|
|
|
|
+{
|
|
|
|
|
+ strcpy(out_str, (n1 != n2) ? "true" : "false");
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static int compute_add (NCDModuleInst *i, uintmax_t n1, uintmax_t n2, char *out_str)
|
|
static int compute_add (NCDModuleInst *i, uintmax_t n1, uintmax_t n2, char *out_str)
|
|
|
{
|
|
{
|
|
|
if (n1 > UINTMAX_MAX - n2) {
|
|
if (n1 > UINTMAX_MAX - n2) {
|
|
@@ -260,6 +267,11 @@ static void func_new_equal (NCDModuleInst *i)
|
|
|
new_templ(i, compute_equal);
|
|
new_templ(i, compute_equal);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void func_new_different (NCDModuleInst *i)
|
|
|
|
|
+{
|
|
|
|
|
+ new_templ(i, compute_different);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void func_new_add (NCDModuleInst *i)
|
|
static void func_new_add (NCDModuleInst *i)
|
|
|
{
|
|
{
|
|
|
new_templ(i, compute_add);
|
|
new_templ(i, compute_add);
|
|
@@ -311,6 +323,11 @@ static const struct NCDModule modules[] = {
|
|
|
.func_new = func_new_equal,
|
|
.func_new = func_new_equal,
|
|
|
.func_die = func_die,
|
|
.func_die = func_die,
|
|
|
.func_getvar = func_getvar
|
|
.func_getvar = func_getvar
|
|
|
|
|
+ }, {
|
|
|
|
|
+ .type = "num_different",
|
|
|
|
|
+ .func_new = func_new_different,
|
|
|
|
|
+ .func_die = func_die,
|
|
|
|
|
+ .func_getvar = func_getvar
|
|
|
}, {
|
|
}, {
|
|
|
.type = "num_add",
|
|
.type = "num_add",
|
|
|
.func_new = func_new_add,
|
|
.func_new = func_new_add,
|