From: Nikodemus Siivola Date: Fri, 9 Dec 2011 13:42:04 +0000 (+0200) Subject: easier to read FAST-READ-U-INTEGER expansion X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=d83bacf0d9c8bbf54f65c8468752978bfa2462e0;p=sbcl.git easier to read FAST-READ-U-INTEGER expansion --- diff --git a/src/code/load.lisp b/src/code/load.lisp index 193f393..dbbab95 100644 --- a/src/code/load.lisp +++ b/src/code/load.lisp @@ -51,19 +51,17 @@ #!-sb-fluid (declaim (inline read-byte)) -;;; FIXME: why do all of these reading functions and macros declare -;;; (SPEED 0)? was there some bug in the compiler which has since -;;; been fixed? --njf, 2004-09-08 - ;;; This expands into code to read an N-byte unsigned integer using ;;; FAST-READ-BYTE. (defmacro fast-read-u-integer (n) - (declare (optimize (speed 0))) - (do ((res '(fast-read-byte) - `(logior (fast-read-byte) - (ash ,res 8))) - (cnt 1 (1+ cnt))) - ((>= cnt n) res))) + (let (bytes) + `(let ,(loop for i from 0 below n + collect (let ((name (gensym "B"))) + (push name bytes) + `(,name ,(if (zerop i) + `(fast-read-byte) + `(ash (fast-read-byte) ,(* i 8)))))) + (logior ,@bytes)))) ;;; like FAST-READ-U-INTEGER, but the size may be determined at run time (defmacro fast-read-var-u-integer (n)