Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r267:a93d0b0977e9
Date: 2013-06-24 17:25 +0200
http://bitbucket.org/pypy/stmgc/changeset/a93d0b0977e9/

Log:    Adapt mangle_hash() to its docstring and always return different
        results for different arguments. (So it may now give negative
        results too.)

diff --git a/c4/demo_random.c b/c4/demo_random.c
--- a/c4/demo_random.c
+++ b/c4/demo_random.c
@@ -373,7 +373,8 @@
             w_t->hash = stm_hash((gcptr)w_t);
             assert(w_t->hash == stm_hash((gcptr)_t));
         }
-        if (w_t->hash < PREBUILT || w_t->hash < SHARED_ROOTS) {
+        if (w_t->hash >= 0 && (w_t->hash < PREBUILT ||
+                               w_t->hash < SHARED_ROOTS)) {
             // should be with predefined hash
             assert (stm_id((gcptr)w_t) != stm_hash((gcptr)w_t));
         }
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -118,7 +118,7 @@
        This formula is reversible: two different values of 'i' will
        always give two different results.
     */
-    return n ^ (n >> 4);
+    return n ^ (((urevision_t)n) >> 4);
 }
 
 
diff --git a/c4/stmgc.h b/c4/stmgc.h
--- a/c4/stmgc.h
+++ b/c4/stmgc.h
@@ -6,6 +6,7 @@
 
 
 typedef intptr_t revision_t;
+typedef uintptr_t urevision_t;
 
 typedef struct stm_object_s {
     revision_t h_tid;
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to