From: Taylor R Campbell Date: Thu, 8 Nov 2018 02:12:36 +0000 (+0000) Subject: Mind my i's and j\s. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~116^2~17 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=5d353c67d831ba1a36c63c51eaafa8e1aa7d790a;p=mit-scheme.git Mind my i's and j\s. --- diff --git a/src/runtime/random.scm b/src/runtime/random.scm index cadd32499..f79374b78 100644 --- a/src/runtime/random.scm +++ b/src/runtime/random.scm @@ -261,8 +261,8 @@ USA. (chacha20-core bytes (fix:* i 64) nonce key chacha-const) (let loop ((j 0) (t 1)) (if (fix:< j 8) - (let ((t (fix:+ t (bytevector-u8-ref nonce i)))) - (bytevector-u8-set! nonce i (fix:and t #xff)) + (let ((t (fix:+ t (bytevector-u8-ref nonce j)))) + (bytevector-u8-set! nonce j (fix:and t #xff)) (loop (fix:+ j 1) (fix:lsh t -8)))))) (let* ((rem (fix:- n (fix:* n/64 64)))) (if (fix:positive? rem) diff --git a/tests/runtime/test-random.scm b/tests/runtime/test-random.scm index 19dedf16c..242380b68 100644 --- a/tests/runtime/test-random.scm +++ b/tests/runtime/test-random.scm @@ -60,9 +60,7 @@ USA. (define-test 'random-bytevector-large (lambda () - (assert-error - (lambda () - (assert-= (bytevector-length (random-bytevector 1088)) 1088))))) + (assert-= (bytevector-length (random-bytevector 1088)) 1088))) (define (define-random-test name procedure) (define-test name