From 13cc9bdccd6d3821d26c61dd313f8fb0a1bfc651 Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Wed, 12 Dec 1990 00:07:24 +0000 Subject: [PATCH] Made ROUND source transform like the one for TRUNCATE, and also used explicit supplied-p so that anyone who does (truncate x nil) gets what they deserve. --- compiler/srctran.lisp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/compiler/srctran.lisp b/compiler/srctran.lisp index e79660431..c12f510ff 100644 --- a/compiler/srctran.lisp +++ b/compiler/srctran.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman (FAHLMAN@CMUC). ;;; ********************************************************************** ;;; -;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.22 1990/12/04 19:36:55 wlott Exp $ +;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.23 1990/12/12 00:07:24 ram Exp $ ;;; ;;; This file contains macro-like source transformations which convert ;;; uses of certain functions into the canonical form desired within the @@ -139,10 +139,14 @@ ;;; Note that all the integer division functions are available for inline ;;; expansion. -(def-source-transform truncate (x &optional y) - (if y - (values nil t) - `(truncate ,x 1))) +(macrolet ((frob (fun) + `(def-source-transform ,fun (x &optional (y nil y-p)) + (declare (ignore y)) + (if y-p + (values nil t) + `(,',fun ,x 1))))) + (frob truncate) + (frob round)) (def-source-transform lognand (x y) `(lognot (logand ,x ,y))) (def-source-transform lognor (x y) `(lognot (logior ,x ,y))) -- GitLab