r10181: Automated commit for Debian build of md5 upstream-version-1.8.5
[md5.git] / md5.lisp
index a7ce4a3c25224a379d1b3e1d55334c73d31f7a2f..46ff79c04d22dd9aa1ffbcc3da7b7bb1362c303d 100644 (file)
--- a/md5.lisp
+++ b/md5.lisp
 
 ;;; Section 2:  Basic Datatypes
 
+#-lispworks
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (deftype ub32 ()
     "Corresponds to the 32bit quantity word of the MD5 Spec"
     `(unsigned-byte 32)))
 
-(defmacro assemble-ub32 (a b c d)
-  "Assemble an ub32 value from the given (unsigned-byte 8) values,
+#+lispworks
+(deftype ub32 ()
+    "Corresponds to the 32bit quantity word of the MD5 Spec"
+    `(unsigned-byte 32))
+
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (defmacro assemble-ub32 (a b c d)
+    "Assemble an ub32 value from the given (unsigned-byte 8) values,
 where a is the intended low-order byte and d the high-order byte."
-  `(the ub32 (logior (ash ,d 24) (ash ,c 16) (ash ,b 8) ,a)))
+    `(the ub32 (logior (ash ,d 24) (ash ,c 16) (ash ,b 8) ,a))))
 
 ;;; Section 3.4:  Auxilliary functions
 
@@ -244,20 +251,6 @@ accordingly."
 ;;; Section 3.4:  Converting 8bit-vectors into 16-Word Blocks
 
 (declaim (inline fill-block fill-block-ub8 fill-block-char))
-(defun fill-block (block buffer offset)
-  "Convert a complete 64 byte input vector segment into the given 16
-word MD5 block.  This currently works on (unsigned-byte 8) and
-character simple-arrays, via the functions `fill-block-ub8' and
-`fill-block-char' respectively."
-  (declare (type (integer 0 #.(- most-positive-fixnum 64)) offset)
-          (type (simple-array ub32 (16)) block)
-          (type (simple-array * (*)) buffer)
-          (optimize (speed 3) (safety 0) (space 0) (debug 0)))
-  (etypecase buffer
-    ((simple-array (unsigned-byte 8) (*))
-     (fill-block-ub8 block buffer offset))
-    (simple-string
-     (fill-block-char block buffer offset))))
 
 (defun fill-block-ub8 (block buffer offset)
   "Convert a complete 64 (unsigned-byte 8) input vector segment
@@ -305,6 +298,21 @@ offset into the given 16 word MD5 block."
                             (char-code (schar buffer (+ j 2)))
                             (char-code (schar buffer (+ j 3)))))))
 
+(defun fill-block (block buffer offset)
+  "Convert a complete 64 byte input vector segment into the given 16
+word MD5 block.  This currently works on (unsigned-byte 8) and
+character simple-arrays, via the functions `fill-block-ub8' and
+`fill-block-char' respectively."
+  (declare (type (integer 0 #.(- most-positive-fixnum 64)) offset)
+          (type (simple-array ub32 (16)) block)
+          (type (simple-array * (*)) buffer)
+          (optimize (speed 3) (safety 0) (space 0) (debug 0)))
+  (etypecase buffer
+    ((simple-array (unsigned-byte 8) (*))
+     (fill-block-ub8 block buffer offset))
+    (simple-string
+     (fill-block-char block buffer offset))))
+
 ;;; Section 3.5:  Message Digest Output
 
 (declaim (inline md5regs-digest))