From: Scott McKay Date: Tue, 8 May 2012 18:46:37 +0000 (+0000) Subject: Yikes, the optimizer for 'deserialize-packed' had a bug *and* a typo X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=a3fde71c672e65e9e0b266add1b2172ea8f54751;p=cl-protobufs.git Yikes, the optimizer for 'deserialize-packed' had a bug *and* a typo git-svn-id: http://svn.internal.itasoftware.com/svn/ita/trunk/qres/lisp/quux/protobufs@542991 f8382938-511b-0410-9cdd-bb47b084005c --- diff --git a/wire-format.lisp b/wire-format.lisp index 9c0186f..8bfc253 100644 --- a/wire-format.lisp +++ b/wire-format.lisp @@ -454,44 +454,45 @@ `(locally (declare (optimize (speed 3) (safety 0) (debug 0)) (type (simple-array (unsigned-byte 8)) ,buffer) (type fixnum ,index)) - (multiple-value-bind (len idx) - (decode-uint32 .buffer ,index) - (declare (type (unsigned-byte 32) len) - (type fixnum idx)) - (let ((end (i+ idx len))) - (declare (type (unsigned-byte 32) end)) - (with-collectors ((values collect-value)) - (loop - (when (>= idx end) - (return-from deserialize-packed (values values idx))) - (multiple-value-bind (val nidx) - ,(ecase type - ((:int32 :uint32) - `(decode-uint32 ,buffer idx)) - ((:int64 :uint64) - `(decode-uint64 ,buffer idx)) - ((:sint32) - `(multiple-value-bind (val idx) - (decode-uint32 ,buffer idx) - (values (zig-zag-decode32 val) idx))) - ((:sint64) - `(multiple-value-bind (val idx) - (decode-uint64 ,buffer idx) - (values (zig-zag-decode64 val) idx))) - ((:fixed32) - `(decode-fixed32 ,buffer idx)) - ((:sfixed32) - `(decode-sfixed32 ,buffer idx)) - ((:fixed64) - `(decode-fixed64 ,buffer idx)) - ((:sfixed64) - `(decode-sfixed64 ,buffer idx)) - ((:float) - `(decode-single ,buffer idx)) - ((:double) - `(decode-double ,buffer idx))) - (collect-value val) - (setq idx nidx))))))) + (block deserialize-packed + (multiple-value-bind (len idx) + (decode-uint32 ,buffer ,index) + (declare (type (unsigned-byte 32) len) + (type fixnum idx)) + (let ((end (i+ idx len))) + (declare (type (unsigned-byte 32) end)) + (with-collectors ((values collect-value)) + (loop + (when (>= idx end) + (return-from deserialize-packed (values values idx))) + (multiple-value-bind (val nidx) + ,(ecase type + ((:int32 :uint32) + `(decode-uint32 ,buffer idx)) + ((:int64 :uint64) + `(decode-uint64 ,buffer idx)) + ((:sint32) + `(multiple-value-bind (val idx) + (decode-uint32 ,buffer idx) + (values (zig-zag-decode32 val) idx))) + ((:sint64) + `(multiple-value-bind (val idx) + (decode-uint64 ,buffer idx) + (values (zig-zag-decode64 val) idx))) + ((:fixed32) + `(decode-fixed32 ,buffer idx)) + ((:sfixed32) + `(decode-sfixed32 ,buffer idx)) + ((:fixed64) + `(decode-fixed64 ,buffer idx)) + ((:sfixed64) + `(decode-sfixed64 ,buffer idx)) + ((:float) + `(decode-single ,buffer idx)) + ((:double) + `(decode-double ,buffer idx))) + (collect-value val) + (setq idx nidx)))))))) form)) (defun deserialize-enum (values buffer index)