From 9436bc39ce1787f8ec8905e7a7a0327a42075d3e Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Wed, 1 May 2019 23:34:42 -0500 Subject: [PATCH] DEFINT-DECODER: Add missing unquote Otherwise we return the unbound symbol INT instead of the value of the we built in the decoder. Fixes bug introduced in 9facf44. --- osc.lisp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osc.lisp b/osc.lisp index e751e50..3a9e82a 100644 --- a/osc.lisp +++ b/osc.lisp @@ -352,6 +352,19 @@ with the current time use (encode-timetag :time)." (ldb (byte 16 0) (decode-int32 s))) #-(or sbcl cmucl openmcl allegro) (error "cant decode floats using this implementation")) +(defmacro defint-decoder (num-of-octets &optional docstring) + (let ((decoder-name (intern (format nil "~:@(decode-uint~)~D" (* 8 num-of-octets)))) + (seq (gensym)) + (int (gensym))) + `(defun ,decoder-name (,seq) + ,@(when docstring + (list docstring)) + (let* ((,int 0) + ,@(loop + for n below num-of-octets + collect `(,int (dpb (aref ,seq ,n) (byte 8 (* 8 (- (1- ,num-of-octets) ,n))) + ,int)))) + ,int)))) (defun decode-uint32 (s) "4 byte -> 32 bit unsigned int"