From d83bacf0d9c8bbf54f65c8468752978bfa2462e0 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 9 Dec 2011 15:42:04 +0200 Subject: [PATCH] easier to read FAST-READ-U-INTEGER expansion --- src/code/load.lisp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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) -- 1.7.10.4