Skip to content
Snippets Groups Projects
Commit cd28c1f9 authored by ram's avatar ram
Browse files

Add random transforms.

parent 321e907f
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment