The beginning of bignums is in place, tests still pass.

This commit is contained in:
Simon Brooke 2018-12-29 22:30:07 +00:00
parent c21a762413
commit 342f0308d3
11 changed files with 134 additions and 96 deletions

View file

@ -150,6 +150,9 @@ void free_cell( struct cons_pointer pointer ) {
case FUNCTIONTV:
dec_ref( cell->payload.function.source );
break;
case INTEGERTV:
dec_ref( cell->payload.integer.more);
break;
case LAMBDATV:
case NLAMBDATV:
dec_ref( cell->payload.lambda.args );

View file

@ -29,12 +29,6 @@
* tag values, all of which must be 4 bytes. Must not collide with vector space tag values
*/
/**
* A word within a bignum - arbitrary precision integer.
*/
#define BIGNUMTAG "BIGN"
#define BIGNUMTV 1313294658
/**
* An ordinary cons cell: 1397641027
*/
@ -168,11 +162,6 @@
*/
#define nilp(conspoint) (check_tag(conspoint,NILTAG))
/**
* true if conspointer points to a cons cell, else false
*/
#define bignump(conspoint) (check_tag(conspoint,BIGNUMTAG))
/**
* true if conspointer points to a cons cell, else false
*/
@ -289,16 +278,6 @@ struct stack_frame {
int args;
};
/**
* payload of a bignum cell. Intentionally similar to an integer payload, but
* with a next pointer.
*/
struct bignum_payload {
int64_t value;
struct cons_pointer next;
};
/**
* payload of a cons cell.
*/
@ -348,6 +327,7 @@ struct free_payload {
*/
struct integer_payload {
int64_t value;
struct cons_pointer more;
};
/**