random_integer() did not work when the input was a fixnum (src/c/num_rand.d).

This commit is contained in:
Juan Jose Garcia Ripoll 2009-12-01 21:43:05 +01:00
parent c89d2c0ffb
commit 5aac759ad1
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,10 @@
ECL 9.12.2:
===========
* Bugs fixed:
- RANDOM broken on 64-bits architectures.
ECL 9.12.1:
===========

View file

@ -155,7 +155,10 @@ random_integer(cl_object limit, cl_object state)
{
#ifdef WITH_GMP
cl_index bit_length = fix(cl_integer_length(limit));
cl_object buffer = ecl_ash(MAKE_FIXNUM(1), bit_length);
cl_object buffer;
if (bit_length <= FIXNUM_BITS)
bit_length = FIXNUM_BITS;
buffer = ecl_ash(MAKE_FIXNUM(1), bit_length);
for (bit_length = buffer->big.big_size; bit_length--; ) {
buffer->big.big_limbs[bit_length] =
generate_limb(state);