klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit 5946d56ba87fa862d03fbc0bb50035a236ece2eb
parent 5550f93a6c10f0ade3278776f33c85783e8390f9
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Tue, 12 Apr 2011 20:33:36 -0300

Bugfix: removed #ifdef 0 that was used while debugging kbigint_div0_mod0. All bigints operators seem to be working as expected.

Diffstat:
Msrc/kinteger.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/kinteger.c b/src/kinteger.c @@ -205,14 +205,12 @@ TValue kbigint_div0_mod0(klisp_State *K, TValue n1, TValue n2, TValue *res_r) Bigint *r = tv2bigint(tv_r); UNUSED(mp_int_div(K, n, d, q, r)); -#if 0 /* Adjust q & r so that -|d/2| <= r < |d/2| */ /* It seems easier to check -|d| <= 2r < |d| */ TValue tv_two_r = kbigint_new(K, false, 0); Bigint *two_r = tv2bigint(tv_two_r); /* two_r = r * 2 = r * 2^1 */ -// UNUSED(mp_int_mul_pow2(K, r, 1, two_r)); - UNUSED(mp_int_mul_value(K, r, 2, two_r)); + UNUSED(mp_int_mul_pow2(K, r, 1, two_r)); TValue tv_abs_d = kbigint_new(K, false, 0); /* NOTE: this makes a copy if d >= 0 */ Bigint *abs_d = tv2bigint(tv_abs_d); @@ -242,7 +240,7 @@ TValue kbigint_div0_mod0(klisp_State *K, TValue n1, TValue n2, TValue *res_r) } } } -#endif + *res_r = kbigint_try_fixint(K, tv_r); return kbigint_try_fixint(K, tv_q); }