Avoid C-isms #5

Merged
PuercoPop merged 4 commits from avoid-c-isms into master 2019-04-02 07:25:07 +00:00
Showing only changes of commit db5dd2b166 - Show all commits

View file

@ -329,15 +329,15 @@
(defun decode-int32 (s) (defun decode-int32 (s)
"4 byte -> 32 bit int -> two's complement (in network byte order)" "4 byte -> 32 bit int -> two's complement (in network byte order)"
(let ((i (decode-uint32 s))) (let ((i (decode-uint32 s)))
(if (>= i #x7fffffff) (if (>= i #.(1- (expt 2 31)))
(- 0 (- #x100000000 i)) (- (- #.(expt 2 32) i))
i))) i)))
(defun decode-int64 (s) (defun decode-int64 (s)
"8 byte -> 64 bit int -> two's complement (in network byte order)" "8 byte -> 64 bit int -> two's complement (in network byte order)"
(let ((i (decode-uint64 s))) (let ((i (decode-uint64 s)))
(if (>= i #x7fffffffffffffff) (if (>= i #.(1- (expt 2 63)))
(- 0 (- #x10000000000000000 i)) (- (- #.(expt 2 64) i))
i))) i)))
;; osc-strings are unsigned bytes, padded to a 4 byte boundary ;; osc-strings are unsigned bytes, padded to a 4 byte boundary