From cd28c1f98e35fa430df0bf0c23c1e0824bc20e46 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Fri, 7 May 1993 16:03:05 +0000
Subject: [PATCH] Add random transforms.

---
 compiler/float-tran.lisp | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/compiler/float-tran.lisp b/compiler/float-tran.lisp
index 8f4cbd29f..adabfb366 100644
--- a/compiler/float-tran.lisp
+++ b/compiler/float-tran.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.14 1992/08/13 18:03:59 ram Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.15 1993/05/07 16:03:05 ram Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -21,11 +21,6 @@
 
 ;;;; Coercions:
 
-#-new-compiler
-(progn
-  (defun %single-float (x) (coerce x 'single-float))
-  (defun %double-float (x) (coerce x 'double-float)))
-
 (defknown %single-float (real) single-float (movable foldable flushable))
 (defknown %double-float (real) double-float (movable foldable flushable))
 
@@ -64,6 +59,21 @@
   (frob truncate %unary-truncate)
   (frob round %unary-round))
 
+;;; Random:
+;;;
+(macrolet ((frob (fun type)
+	     `(deftransform random ((num &optional state)
+				    (,type &optional *))
+		"use inline float operations"
+		'(,fun num state))))
+  (frob %random-single-float single-float)
+  (frob %random-double-float double-float))
+
+(deftransform random ((num &optional state)
+		      ((integer 1 #.random-fixnum-max) &optional *))
+  "use inline fixnum operations"
+  '(rem (random-chunk (or state *random-state*)) num))
+
 
 ;;;; Float accessors:
 
-- 
GitLab