From a15c4d7a089e2480cc8e6c31d469a2c995d2578a Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 14 Dec 2018 17:05:50 +0000 Subject: [PATCH] Fix sign error and mask size in fix:bitcount16. --- src/runtime/random.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/random.scm b/src/runtime/random.scm index 7a4e30cc0..14be33598 100644 --- a/src/runtime/random.scm +++ b/src/runtime/random.scm @@ -353,12 +353,12 @@ USA. (define (fix:bitcount16 x) (let* ((x1 (fix:- x (fix:and (fix:lsh x -1) #x5555))) (x2 (fix:+ (fix:and (fix:lsh x1 -2) #x3333) (fix:and x1 #x3333))) - (x3 (fix:and (fix:+ x2 (fix:lsh x2 4)) #x0f0f)) + (x3 (fix:and (fix:+ x2 (fix:lsh x2 -4)) #x0f0f)) (c0 x3) (c1 (fix:lsh x3 -8)) (s (fix:+ c0 c1))) (declare (integrate x1 x2 x3 x4 c0 c1 s)) - (fix:and s #xf))) + (fix:and s #x1f))) (declare (integrate-operator fix:clz16)) (define (fix:clz16 x) -- 2.25.1