Refactor the internal symbols

This commit is contained in:
2022-08-22 14:18:38 +03:00
parent ca8251973e
commit 48bddb6db8
22 changed files with 195 additions and 262 deletions
+6 -6
View File
@@ -4,7 +4,7 @@
#include "../../include/set.h"
#include "../__internal/rbtree.h"
static inline int rbnode_compare(const rbnode_t* s0, const rbnode_t* s1, vtype t) {
static inline int libcdsb_builtin_compare(const rbnode_t* s0, const rbnode_t* s1, vtype t) {
return vnode_compare(s0->value, t, s1->value, t);
}
@@ -34,13 +34,13 @@ int vset_compare(const set_t* s0, const set_t* s1) {
stack_flush(&z);
return rbnode_is_empty(c0) ? -1 : 1;
}
} else if ((cmp = rbnode_compare(c0, c1, s0->type))) {
} else if ((cmp = libcdsb_builtin_compare(c0, c1, s0->type))) {
if (c0->left == c1->right) { // == rbnode_empty
cmp = rbnode_compare(c0->right, c1, s0->type);
if (!cmp) cmp = rbnode_compare(c0, c1->left, s0->type);
cmp = libcdsb_builtin_compare(c0->right, c1, s0->type);
if (!cmp) cmp = libcdsb_builtin_compare(c0, c1->left, s0->type);
} else if (c0->right == c1->left) { // == rbnode_empty
cmp = rbnode_compare(c0, c1->right, s0->type);
if (!cmp) cmp = rbnode_compare(c0->left, c1, s0->type);
cmp = libcdsb_builtin_compare(c0, c1->right, s0->type);
if (!cmp) cmp = libcdsb_builtin_compare(c0->left, c1, s0->type);
}
if (cmp) {
+3 -3
View File
@@ -4,7 +4,7 @@
#include "../../include/set.h"
#include "../__internal/rbtree.h"
static inline hash_t rbnode_hash(const rbnode_t* s, vtype t) {
static inline hash_t libcdsb_builtin_hash(const rbnode_t* s, vtype t) {
return vnode_hash(&s->value, t);
}
@@ -54,7 +54,7 @@ hash_t vset_hash(const set_t* s) {
} while (!is_null(c0 = stack_pop(&z)));
}
v = rbnode_hash(c1, s->type);
v = libcdsb_builtin_hash(c1, s->type);
stack_push(&z, s->root->right);
if (!rbnode_is_empty(c0 = stack_pop(&z))) {
@@ -65,7 +65,7 @@ hash_t vset_hash(const set_t* s) {
} while (!is_null(c0 = stack_pop(&z)));
}
v += rbnode_hash(c1, s->type);
v += libcdsb_builtin_hash(c1, s->type);
return (hash ^ v) + VTYPE_SET;
}