cs: fix hashing on vector cycles
This commit is contained in:
parent
b5cce5fcab
commit
11f12d69bd
|
@ -356,6 +356,8 @@ transcript.
|
||||||
(define non-z void)
|
(define non-z void)
|
||||||
|
|
||||||
(define (find-depth go)
|
(define (find-depth go)
|
||||||
|
(cond
|
||||||
|
[(eq? 'racket (system-type 'vm))
|
||||||
; Find depth that triggers a stack overflow (assuming no other
|
; Find depth that triggers a stack overflow (assuming no other
|
||||||
; threads are running and overflowing)
|
; threads are running and overflowing)
|
||||||
(let ([v0 (make-vector 6)]
|
(let ([v0 (make-vector 6)]
|
||||||
|
@ -367,4 +369,8 @@ transcript.
|
||||||
(if (> (vector-ref v1 5)
|
(if (> (vector-ref v1 5)
|
||||||
(vector-ref v0 5))
|
(vector-ref v0 5))
|
||||||
d
|
d
|
||||||
(find-loop (* 2 d))))))
|
(find-loop (* 2 d)))))]
|
||||||
|
[else
|
||||||
|
;; No way to detect stack overflow, and it's less interesting anyway,
|
||||||
|
;; but make up a number for testing purposes
|
||||||
|
1000]))
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
(cond
|
(cond
|
||||||
[(fx= i len) (values hc burn)]
|
[(fx= i len) (values hc burn)]
|
||||||
[else
|
[else
|
||||||
(let-values ([(hc0 burn) (equal-hash-loop (vector-ref x i) burn 0)])
|
(let-values ([(hc0 burn) (equal-hash-loop (vector-ref x i) (fx+ burn 2) 0)])
|
||||||
(vec-loop (fx+ i 1)
|
(vec-loop (fx+ i 1)
|
||||||
burn
|
burn
|
||||||
(+/fx (mix2 hc) hc0)))]))]))]
|
(+/fx (mix2 hc) hc0)))]))]))]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user