From cb331e69ae60c61d35dd595c71408bc7fb73cca6 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Tue, 11 Jun 2024 03:06:32 +0200 Subject: Add asserts --- bxgen.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bxgen.c b/bxgen.c index 00bfb88..6c9acf0 100755 --- a/bxgen.c +++ b/bxgen.c @@ -401,16 +401,17 @@ void proc_node_remove(pool_t *pool, i64 proc, i64 node) { proc_t *p = &pool->entities[proc].proc; node_t *n = &pool->entities[node].node; + // TODO + // Implement large entities. + assert(n->index_in_proc != UNDEFINED); + assert(p->nodes[n->index_in_proc] == node); if (n->op == CTRL_RET) { assert(p->ret_index != UNDEFINED); p->ret_index = UNDEFINED; } - // TODO - // Implement large entities. - p->nodes[n->index_in_proc] = UNDEFINED; n->index_in_proc = UNDEFINED; } @@ -462,11 +463,12 @@ void unit_proc_remove(pool_t *pool, i64 unit, i64 proc) { unit_t *u = &pool->entities[unit].unit; proc_t *p = &pool->entities[proc].proc; - assert(p->index_in_unit != UNDEFINED); - // TODO // Implement large entities. + assert(p->index_in_unit != UNDEFINED); + assert(u->procs[p->index_in_unit] == proc); + u->procs[p->index_in_unit] = UNDEFINED; p->index_in_unit = UNDEFINED; } -- cgit v1.2.3