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

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Wed Jun 9 20:23:48 UTC 2004


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

Modified Files:
	inspect.lisp 
Log Message:
Moved some bignum operators here from integers.lisp.

Date: Wed Jun  9 13:23:48 2004
Author: ffjeld

Index: movitz/losp/muerte/inspect.lisp
diff -u movitz/losp/muerte/inspect.lisp:1.10 movitz/losp/muerte/inspect.lisp:1.11
--- movitz/losp/muerte/inspect.lisp:1.10	Wed Jun  2 16:21:13 2004
+++ movitz/losp/muerte/inspect.lisp	Wed Jun  9 13:23:48 2004
@@ -10,7 +10,7 @@
 ;;;; Author:        Frode Vatvedt Fjeld <frodef at acm.org>
 ;;;; Created at:    Fri Oct 24 09:50:41 2003
 ;;;;                
-;;;; $Id: inspect.lisp,v 1.10 2004/06/02 23:21:13 ffjeld Exp $
+;;;; $Id: inspect.lisp,v 1.11 2004/06/09 20:23:48 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -268,3 +268,26 @@
 	   (+ -1 object-location
 	      #.(movitz::movitz-type-word-size :movitz-struct)
 	      (* 2 (truncate (+ (structure-object-length object) 1) 2))))))))
+
+(defun %bignum-bigits (x)
+  (%bignum-bigits x))
+
+(defun copy-bignum (old)
+  (check-type old bignum)
+  (let* ((length (1+ (%bignum-bigits old)))
+	 (new (malloc-data-words length)))
+    (with-inline-assembly (:returns :eax)
+      (:compile-two-forms (:eax :ebx) new old)
+      (:compile-form (:result-mode :edx) length)
+     copy-bignum-loop
+      (:subl #.movitz:+movitz-fixnum-factor+ :edx)
+      (:movl (:ebx :edx #.movitz:+other-type-offset+) :ecx)
+      (:movl :ecx (:eax :edx #.movitz:+other-type-offset+))
+      (:jnz 'copy-bignum-loop))))
+
+(defun print-bignum (x)
+  (check-type x bignum)
+  (dotimes (i (1+ (%bignum-bigits x)))
+    (format t "~8,'0X " (memref x -6 i :unsigned-byte32)))
+  (terpri)
+  (values))





More information about the Movitz-cvs mailing list