diff options
Diffstat (limited to 'sys/libbio/phylo.c')
-rw-r--r-- | sys/libbio/phylo.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/libbio/phylo.c b/sys/libbio/phylo.c new file mode 100644 index 0000000..8033e35 --- /dev/null +++ b/sys/libbio/phylo.c @@ -0,0 +1,20 @@ +#include <u.h> +#include <libn.h> +#include <libbio.h> + +error +phylo·addchild(bio·Node* parent, bio·Node* child) +{ + bio·Node *it, *sibling; + if (parent->nchild < 2) { + parent->child[parent->nchild++] = child; + } else { + for (it = parent->child[1]->sibling; it != nil; it = it->sibling) { + sibling = it; + } + sibling->sibling = child; + parent->nchild++; + } + + return 0; +} |