[movitz-cvs] CVS update: movitz/losp/muerte/integers.lisp

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Wed Apr 13 07:26:29 UTC 2005


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv5574

Modified Files:
	integers.lisp 
Log Message:
Added compiler-macro for logbitp.

Date: Wed Apr 13 09:26:29 2005
Author: ffjeld

Index: movitz/losp/muerte/integers.lisp
diff -u movitz/losp/muerte/integers.lisp:1.104 movitz/losp/muerte/integers.lisp:1.105
--- movitz/losp/muerte/integers.lisp:1.104	Thu Nov 25 19:05:48 2004
+++ movitz/losp/muerte/integers.lisp	Wed Apr 13 09:26:29 2005
@@ -1,6 +1,6 @@
 ;;;;------------------------------------------------------------------
 ;;;; 
-;;;;    Copyright (C) 2000-2004,
+;;;;    Copyright (C) 2000-2005,
 ;;;;    Department of Computer Science, University of Tromso, Norway
 ;;;; 
 ;;;; Filename:      integers.lisp
@@ -9,7 +9,7 @@
 ;;;; Created at:    Wed Nov  8 18:44:57 2000
 ;;;; Distribution:  See the accompanying file COPYING.
 ;;;;                
-;;;; $Id: integers.lisp,v 1.104 2004/11/25 18:05:48 ffjeld Exp $
+;;;; $Id: integers.lisp,v 1.105 2005/04/13 07:26:29 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -1513,6 +1513,19 @@
 	       (:shrl ,movitz::+movitz-fixnum-shift+ :ecx)
 	       (:btl :ecx (:ebx (:offset movitz-bignum bigit0))))))))
     (do-it)))
+
+(define-compiler-macro logbitp (&whole form &environment env index integer)
+  (if (not (movitz:movitz-constantp index env))
+      form
+    (let ((index (movitz:movitz-eval index env)))
+      (check-type index (integer 0 *))
+      (typecase index
+	((integer 0 31)
+	 `(with-inline-assembly (:returns :boolean-cf=1)
+	    (:compile-form (:result-mode :untagged-fixnum-ecx) ,integer)
+	    (:btl ,index :ecx)))
+	(t form)))))
+
 
 (defun logand (&rest integers)
   (numargs-case




More information about the Movitz-cvs mailing list