[oct-cvs] Oct commit: oct qd-rep.lisp

rtoy rtoy at common-lisp.net
Sun Sep 16 05:01:16 UTC 2007


Update of /project/oct/cvsroot/oct
In directory clnet:/tmp/cvs-serv7899

Modified Files:
	qd-rep.lisp 
Log Message:
Make QD-0, QD-1, QD-2, and QD-3 macros to make sure access is fast for
all Lisps.


--- /project/oct/cvsroot/oct/qd-rep.lisp	2007/08/25 17:08:48	1.4
+++ /project/oct/cvsroot/oct/qd-rep.lisp	2007/09/16 05:01:16	1.5
@@ -107,6 +107,7 @@
 (deftype %quad-double ()
   '(simple-array double-float (4)))
 
+#||
 (defun qd-0 (q)
   (declare (type %quad-double q)
 	   (optimize (speed 3)))
@@ -127,6 +128,20 @@
 	   (optimize (speed 3)))
   (aref q 3))
 
+||#
+
+(defmacro qd-0 (q)
+  `(aref ,q 0))
+
+(defmacro qd-1 (q)
+  `(aref ,q 1))
+
+(defmacro qd-2 (q)
+  `(aref ,q 2))
+
+(defmacro qd-3 (q)
+  `(aref ,q 3))
+
 (eval-when (:compile-toplevel :load-toplevel :execute)
 (defun %make-qd-d (a0 a1 a2 a3)
   "Make a %quad-double from 4 double-floats, exactly using the given
@@ -144,6 +159,16 @@
     a))
 )
 
+#+nil
+(defmacro %make-qd-d (a0 a1 a2 a3)
+  (let ((a (gensym)))
+    `(let ((,a (make-array 4 :element-type 'double-float)))
+      (setf (aref ,a 0) ,a0)
+      (setf (aref ,a 1) ,a1)
+      (setf (aref ,a 2) ,a2)
+      (setf (aref ,a 3) ,a3)
+      ,a)))
+
 (defun qd-parts (qd)
   "Extract the four doubles comprising a quad-double and return them
   as multiple values.  The most significant double is the first value."




More information about the oct-cvs mailing list