Begin to handle tommath return values

This commit is contained in:
Justin Ethier 2019-10-22 13:35:08 -04:00
parent e3a90cb3b1
commit 03abd758b5

View file

@ -1522,7 +1522,8 @@ int Cyc_bignum_cmp(bn_cmp_type type, object x, int tx, object y, int ty)
if (tx == bignum_tag && ty == bignum_tag) { if (tx == bignum_tag && ty == bignum_tag) {
cmp = mp_cmp(&bignum_value(x), &bignum_value(y)); cmp = mp_cmp(&bignum_value(x), &bignum_value(y));
} else if (tx == bignum_tag && ty == -1) { \ } else if (tx == bignum_tag && ty == -1) { \
mp_init(&tmp); // JAE TODO: make a macro out of this, and use for other BN calls
mp_init(&tmp) ? fprintf(stderr, "Error initializing bignum"), exit(1) : 0;
Cyc_int2bignum(obj_obj2int(y), &tmp); Cyc_int2bignum(obj_obj2int(y), &tmp);
cmp = mp_cmp(&bignum_value(x), &tmp); cmp = mp_cmp(&bignum_value(x), &tmp);
mp_clear(&tmp); mp_clear(&tmp);