diff --git a/src/CHANGELOG b/src/CHANGELOG index ab942f06a..66e6c8eed 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -55,6 +55,9 @@ ECL 0.9k: - Building a statically linked ECL works again. + - Equal random states now compare properly under EQUALP and their hash keys + are also equal. + ;;; Local Variables: *** ;;; mode:text *** ;;; fill-column:79 *** diff --git a/src/c/hash.d b/src/c/hash.d index 8443543ee..5b935edd1 100644 --- a/src/c/hash.d +++ b/src/c/hash.d @@ -98,9 +98,7 @@ _hash_equal(int depth, cl_hashkey h, cl_object x) h = _hash_equal(depth, h, x->pathname.directory); h = _hash_equal(depth, h, x->pathname.name); h = _hash_equal(depth, h, x->pathname.type); - return _hash_equal(depth, h, x->pathname.name); - case t_random: - return hash_word(h, x->random.value); + return _hash_equal(depth, h, x->pathname.version); case t_bitvector: /* Notice that we may round out some bits. We must do this * because the fill pointer may be set in the middle of a byte. @@ -108,6 +106,8 @@ _hash_equal(int depth, cl_hashkey h, cl_object x) * because otherwise two bit arrays which are EQUAL might * have different hash keys. */ return hash_string(h, x->vector.self.ch, x->vector.fillp / 8); + case t_random: + return _hash_equal(depth, h, x->random.value); default: return _hash_eql(h, x); } diff --git a/src/c/newhash.h b/src/c/newhash.h index d807bc246..5708de610 100644 --- a/src/c/newhash.h +++ b/src/c/newhash.h @@ -138,9 +138,9 @@ hash_string(cl_index initval, const unsigned char *k, cl_index len) } #endif -static cl_index hash_word(cl_index c, cl_index a) +static cl_index hash_word(cl_index c, cl_index w) { - cl_index b = GOLDEN_RATIO; + cl_index a = w + GOLDEN_RATIO, b = GOLDEN_RATIO; mix(a, b, c); return c; } diff --git a/src/c/num_rand.d b/src/c/num_rand.d index f1f9ea56a..31aa4372a 100644 --- a/src/c/num_rand.d +++ b/src/c/num_rand.d @@ -62,8 +62,9 @@ generate_double(cl_object rs) cl_object init_random_state() { - cl_object a = ecl_alloc_simple_vector(MT_N + 1, aet_index); - ulong *mt = a->vector.self.index; + cl_index bytes = sizeof(ulong) * (MT_N + 1); + cl_object a = cl_alloc_simple_base_string(bytes); + ulong *mt = (ulong*)a->base_string.self; int j; #if !defined(_MSC_VER) && !defined(mingw32) FILE *fp = fopen("/dev/urandom","r"); @@ -92,7 +93,7 @@ generate_int32(cl_object state) { static ulong mag01[2]={0x0UL, MATRIX_A}; ulong y; - ulong *mt = state->vector.self.index; + ulong *mt = (ulong*)state->base_string.self; if (mt[MT_N] >= MT_N){ /* refresh data */ int kk; diff --git a/src/c/predicate.d b/src/c/predicate.d index 92f995a80..141350b26 100644 --- a/src/c/predicate.d +++ b/src/c/predicate.d @@ -500,6 +500,8 @@ BEGIN: } return TRUE; } + case t_random: + return ecl_equalp(x->random.value, y->random.value); default: return FALSE; } diff --git a/src/lsp/config.lsp.in b/src/lsp/config.lsp.in index 8c1082739..f729e94af 100644 --- a/src/lsp/config.lsp.in +++ b/src/lsp/config.lsp.in @@ -24,7 +24,7 @@ Returns, as a string, the location of the machine on which ECL runs." (defun lisp-implementation-version () "Args:() Returns the version of your ECL as a string." - "@PACKAGE_VERSION@ (CVS 2008-02-01 20:07)") + "@PACKAGE_VERSION@ (CVS 2008-02-02 20:05)") (defun machine-type () "Args: ()