From d4cb5a5ec2cd4258c38206a3d261c64c5d0db448 Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Thu, 26 Jun 2008 21:00:25 +0000 Subject: [PATCH] code/rand-mt19937.lisp: o Recursively call RANDOM for the integer case to let the deftransform handle the case. compiler/float-tran.lisp: o Remove comment about modifying RANDOM to match the deftransform. We're automatically in sync now. --- code/rand-mt19937.lisp | 13 +++---------- compiler/float-tran.lisp | 6 +----- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/code/rand-mt19937.lisp b/code/rand-mt19937.lisp index 682c06756..fc9b30223 100644 --- a/code/rand-mt19937.lisp +++ b/code/rand-mt19937.lisp @@ -6,7 +6,7 @@ ;;; placed in the Public domain, and is provided 'as is'. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/rand-mt19937.lisp,v 1.16 2008/06/24 17:27:51 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/rand-mt19937.lisp,v 1.17 2008/06/26 21:00:24 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -444,15 +444,8 @@ #+long-float %long-float)) (cond ((typep arg '(integer 1 #x100000000)) - ;; Basically, pretend (random-chunk) produces a 32-bit fractional - ;; number, multiply by arg, and take the integer part. - ;; - ;; WARNING: If you change this be sure to make the deftransform - ;; for RANDOM in float-tran.lisp does the same thing. - (if (= arg #x100000000) - (random-chunk state)) - (values (bignum::%multiply (random-chunk state) - arg))) + ;; Let the compiler deftransform take care of this case. + (random arg state)) ((and (typep arg 'single-float) (> arg 0.0F0)) (%random-single-float arg state)) ((and (typep arg 'double-float) (> arg 0.0D0)) diff --git a/compiler/float-tran.lisp b/compiler/float-tran.lisp index 7d4ada68c..180ecaf81 100644 --- a/compiler/float-tran.lisp +++ b/compiler/float-tran.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.120 2008/06/24 17:27:51 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.121 2008/06/26 21:00:25 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -255,10 +255,6 @@ ;; it were a 32-bit fraction between 0 and 1, exclusive. Multiply ;; this by num-high to get a random number between 0 and num-high, ;; This should have no bias. - ;; - ;; WARNING: If you change this, be sure to look at the definition - ;; of RANDOM so that it produces the same value as the - ;; deftransform would produce. (cond ((constant-continuation-p num) (if (= num-high (expt 2 32)) '(random-chunk (or state *random-state*)) -- GitLab