aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2017-01-06 14:48:53 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2017-01-06 14:48:53 -0500
commit9ef43720d1b2b3125f4367f3ccf2cb7129d1a9ba (patch)
tree7b5339408b9770e2db7483eda61af2166635e912 /node.c
parent0cb66f4f80cc8c2df63aed30e2cf5753a106b951 (diff)
downloadegawk-9ef43720d1b2b3125f4367f3ccf2cb7129d1a9ba.tar.gz
egawk-9ef43720d1b2b3125f4367f3ccf2cb7129d1a9ba.tar.bz2
egawk-9ef43720d1b2b3125f4367f3ccf2cb7129d1a9ba.zip
Enhance API to support extended-precision arithmetic and implement intdiv as a demonstration.
Diffstat (limited to 'node.c')
-rw-r--r--node.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/node.c b/node.c
index 97f65fa3..b83d2ac2 100644
--- a/node.c
+++ b/node.c
@@ -332,16 +332,8 @@ r_dupnode(NODE *n)
static NODE *
r_make_number(double x)
{
- NODE *r;
- getnode(r);
- r->type = Node_val;
+ NODE *r = make_number_node(0);
r->numbr = x;
- r->flags = MALLOC|NUMBER|NUMCUR;
- r->valref = 1;
- r->stptr = NULL;
- r->stlen = 0;
- r->wstptr = NULL;
- r->wstlen = 0;
return r;
}
@@ -1005,6 +997,10 @@ BLOCK nextfree[BLOCK_MAX] = {
{ 0, NULL}, /* invalid */
{ sizeof(NODE), NULL },
{ sizeof(BUCKET), NULL },
+#ifdef HAVE_MPFR
+ { sizeof(mpfr_t), NULL },
+ { sizeof(mpz_t), NULL },
+#endif
};
@@ -1021,6 +1017,7 @@ more_blocks(int id)
size = nextfree[id].size;
+ assert(size >= sizeof(BLOCK));
emalloc(freep, BLOCK *, BLOCKCHUNK * size, "more_blocks");
p = (char *) freep;
endp = p + BLOCKCHUNK * size;