fixed (modulo <bignum> 0) and (modulo <bignum> <largish-fixnum>)
errors that caused either a segfault or returning an incorrect value.
This commit is contained in:
parent
f495665f7d
commit
1803f9f23c
|
@ -1737,7 +1737,9 @@
|
||||||
[(bignum? n)
|
[(bignum? n)
|
||||||
(cond
|
(cond
|
||||||
[(fixnum? m)
|
[(fixnum? m)
|
||||||
(foreign-call "ikrt_bnfx_modulo" n m)]
|
(if (eqv? m 0)
|
||||||
|
(die 'modulo "division by zero" n m)
|
||||||
|
(foreign-call "ikrt_bnfx_modulo" n m))]
|
||||||
[(bignum? m)
|
[(bignum? m)
|
||||||
(if ($bignum-positive? n)
|
(if ($bignum-positive? n)
|
||||||
(if ($bignum-positive? m)
|
(if ($bignum-positive? m)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1809
|
1810
|
||||||
|
|
|
@ -1797,7 +1797,7 @@ ikrt_bnfxdivrem(ikptr x, ikptr y, ikpcb* pcb){
|
||||||
|
|
||||||
ikptr
|
ikptr
|
||||||
ikrt_bnfx_modulo(ikptr x, ikptr y /*, ikpcb* pcb */){
|
ikrt_bnfx_modulo(ikptr x, ikptr y /*, ikpcb* pcb */){
|
||||||
int yint = unfix(y);
|
long int yint = unfix(y);
|
||||||
mp_limb_t* s2p = (mp_limb_t*)(long)(x+off_bignum_data);
|
mp_limb_t* s2p = (mp_limb_t*)(long)(x+off_bignum_data);
|
||||||
ikptr fst = ref(x, -vector_tag);
|
ikptr fst = ref(x, -vector_tag);
|
||||||
mp_size_t s2n = bnfst_limb_count(fst);
|
mp_size_t s2n = bnfst_limb_count(fst);
|
||||||
|
|
Loading…
Reference in New Issue