~theothornhill/cl-bare

fd74520a881bd1a79694156a42cbd42ef416f6a1 — Theodor Thornhill 3 years ago cebdeb4
Simplify optionals implementation
1 files changed, 5 insertions(+), 5 deletions(-)

M src/bare.lisp
M src/bare.lisp => src/bare.lisp +5 -5
@@ 151,8 151,8 @@ Set this dynamically in the function calling the DATA defbinary.")
    (read-binary type stream)))

(defun write-optional-type (object stream)
  (when (plusp (slot-value object 'value))
    (write-byte 1 stream)
    (write-binary object stream))
  (when (zerop (slot-value object 'value))
    (write-byte 0 stream)))
  (if (zerop (slot-value object 'value))
      (write-byte 0 stream)
      (progn
        (write-byte 1 stream)
        (write-binary object stream))))