[buddy] get rid of many recursive algorithms

This patch addresses the BuDDy part of #396,
reported by Florian Renkin and Reed Oei.

* src/kernel.c, src/kernel.h: Declare a bddrecstack and
associated macros.  Resize it when new variable are declared.
* src/cache.h: Add a BddCache_index macro.
* src/bddop.c (not_rec, apply_rec, quant_rec, appquant_rec,
support_rec, ite_rec, compose_rec, restrict_rec, satone_rec,
satoneset_rec): Rewrite using this stack to get rid of the recursion.
This commit is contained in:
Alexandre Duret-Lutz 2020-06-08 22:19:17 +02:00
parent d7b3d05e57
commit 6f76121b89
4 changed files with 856 additions and 520 deletions

View file

@ -1,5 +1,5 @@
/*========================================================================
Copyright (C) 1996-2002 by Jorn Lind-Nielsen
Copyright (C) 1996-2002, 2020 by Jorn Lind-Nielsen
All rights reserved
Permission is hereby granted, without written agreement and without
@ -67,7 +67,7 @@ extern int BddCache_resize(BddCache *, int);
extern void BddCache_reset(BddCache *);
#define BddCache_lookup(cache, hash) (&(cache)->table[hash & ((cache)->tablesize - 1)])
#define BddCache_index(cache, hash, index) (&(cache)->table[index = (hash & ((cache)->tablesize - 1))])
#endif /* _CACHE_H */