From 229a5ca3c4cfe533407567de2c745d26a306d391 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 11 Dec 2011 09:50:51 -0800 Subject: * arith.c: Regenerated. * arith.txr (normalize): Bugfix: was not turning +/- NUM_MAX bignums into fixnums. --- ChangeLog | 7 +++++++ arith.c | 14 +++++--------- arith.txr | 14 +++++--------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 239d5786..da257cff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-12-11 Kaz Kylheku + + * arith.c: Regenerated. + + * arith.txr (normalize): Bugfix: was not turning +/- NUM_MAX bignums + into fixnums. + 2011-12-11 Kaz Kylheku * arith.c: Regenerated. diff --git a/arith.c b/arith.c index 85a0f346..5c59af23 100644 --- a/arith.c +++ b/arith.c @@ -74,16 +74,12 @@ static val bignum_dbl_ipt(double_intptr_t di) static val normalize(val bignum) { - switch (mp_cmp_mag(mp(bignum), &NUM_MAX_MP)) { - case MP_EQ: - case MP_GT: + if (mp_cmp_mag(mp(bignum), &NUM_MAX_MP) == MP_GT) { return bignum; - default: - { - cnum fixnum; - mp_get_intptr(mp(bignum), &fixnum); - return num(fixnum); - } + } else { + cnum fixnum; + mp_get_intptr(mp(bignum), &fixnum); + return num(fixnum); } } diff --git a/arith.txr b/arith.txr index 736645da..cba98be2 100644 --- a/arith.txr +++ b/arith.txr @@ -79,16 +79,12 @@ static val bignum_dbl_ipt(double_intptr_t di) static val normalize(val bignum) { - switch (mp_cmp_mag(mp(bignum), &NUM_MAX_MP)) { - case MP_EQ: - case MP_GT: + if (mp_cmp_mag(mp(bignum), &NUM_MAX_MP) == MP_GT) { return bignum; - default: - { - cnum fixnum; - mp_get_intptr(mp(bignum), &fixnum); - return num(fixnum); - } + } else { + cnum fixnum; + mp_get_intptr(mp(bignum), &fixnum); + return num(fixnum); } } -- cgit v1.2.3