(type (alien (* unsigned-long)) z)
(type bignum-type b)
(type bignum-index count))
- (dotimes (i count (%normalize-bignum b count))
+ (dotimes (i count (%normalize-bignum b (1+ count)))
(%bignum-set b i (deref z i))))
(defun gmp-z-to-bignum-neg (z b count)
(let ((carry 0)
(add 1))
(declare (type (mod 2) carry add))
- (dotimes (i count b)
+ (dotimes (i count (%normalize-bignum b (1+ count)))
(multiple-value-bind (value carry-tmp)
(%add-with-carry
(%lognot (deref z i)) add carry)
collect size into sizes
collect `(,gres (struct gmpint)) into declares
collect `(__gmpz_init (addr ,gres)) into inits
- collect `(,size (1+ (abs (slot ,gres 'mp_size))))
+ collect `(,size (abs (slot ,gres 'mp_size)))
into resinits
- collect `(,res (%allocate-bignum ,size))
+ collect `(,res (%allocate-bignum (1+ ,size)))
into resinits
collect `(setf ,res (if (minusp (slot ,gres 'mp_size)) ; check for negative result
(gmp-z-to-bignum-neg (slot ,gres 'mp_d) ,res ,size)