getting really close now, but I need to implement removing from lists
This commit is contained in:
parent
cb1738376d
commit
82a102c421
1 changed files with 21 additions and 10 deletions
31
main.c
31
main.c
|
|
@ -353,9 +353,9 @@ static void print(uint16_t truthtable, int depth)
|
|||
|
||||
printf("%s(%s", start, end);
|
||||
print(e->cond, depth + 1);
|
||||
printf(" %s?%s ", start, end);
|
||||
printf("%s ? %s", start, end);
|
||||
print(e->left, depth + 1);
|
||||
printf(" %s:%s ", start, end);
|
||||
printf("%s : %s", start, end);
|
||||
print(e->right, depth + 1);
|
||||
printf("%s)%s", start, end);
|
||||
|
||||
|
|
@ -473,7 +473,7 @@ void calculate_simplifications(void)
|
|||
|
||||
assert(cost < lookup[truthtable].cost);
|
||||
|
||||
int index =todo. reverse[truthtable], new_index;
|
||||
int index = todo.reverse[truthtable], new_index;
|
||||
|
||||
while (index > 0 && lookup[todo.data[new_index = (index - 1) / 2]].cost > cost)
|
||||
{
|
||||
|
|
@ -491,27 +491,32 @@ void calculate_simplifications(void)
|
|||
}
|
||||
|
||||
// create a list of the "done" truthtables
|
||||
struct {
|
||||
struct list {
|
||||
int headtails[N], next[N], head;
|
||||
|
||||
// for debugging:
|
||||
bool in[N];
|
||||
} done = {};
|
||||
} done, undone;
|
||||
|
||||
// init 'done':
|
||||
void init(struct list* this)
|
||||
{
|
||||
done.head = -1;
|
||||
this->head = -1;
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
done.headtails[i] = -1;
|
||||
this->headtails[i] = -1;
|
||||
|
||||
done.in[i] = false;
|
||||
this->in[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void insert(int index)
|
||||
init(&done), init(&undone);
|
||||
|
||||
void insert(struct list* this, int index)
|
||||
{
|
||||
assert(!"TODO");
|
||||
#if 0
|
||||
assert(!done.in[index]);
|
||||
|
||||
int head = index & 1 ? index & ~(index & -index) : index, prevhead = -1;
|
||||
|
|
@ -580,6 +585,7 @@ void calculate_simplifications(void)
|
|||
}
|
||||
|
||||
done.in[index] = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
append(W, 0), lookup[W].kind = ek_W;
|
||||
|
|
@ -638,7 +644,11 @@ void calculate_simplifications(void)
|
|||
lookup[not_truthtable].left = truthtable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this macro will be removed soon...
|
||||
|
||||
assert(!"TODO");
|
||||
#if 0
|
||||
#define BINARY_OPERATOR(ekind, function) \
|
||||
{ \
|
||||
for (int i = done.head; i != -1; i = done.next[i]) \
|
||||
|
|
@ -793,6 +803,7 @@ void calculate_simplifications(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (verbose && print_with_color)
|
||||
|
|
|
|||
Loading…
Reference in a new issue