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.
This commit is contained in:
Javier Olaechea 2019-05-01 23:34:42 -05:00 committed by nik gaffney
parent db580d2eaf
commit 9436bc39ce
Signed by: nik
GPG key ID: 989F5E6EDB478160

View file

@ -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"