Skip to content

Commit

Permalink
Bug fix: When a DOUBLE-FLOAT was specified in a DEFBINARY form, the
Browse files Browse the repository at this point in the history
generated code read a single-precision float instead.
  • Loading branch information
John Doe committed Dec 1, 2016
1 parent 61a4fe3 commit 901af41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion binary.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ TYPE-INFO is a DEFBINARY-TYPE that contains the following:
(return-from this-function
(values defstruct-type reader writer)))))
((type length &key (external-format :latin1))
:where (eq type 'fixed-length-string)
:where (member type '(fixed-length-string fixed-string))
(setf reader*
(let ((bytes (gensym))
(bytes* (gensym))
Expand Down
6 changes: 3 additions & 3 deletions float.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -512,16 +512,16 @@ value is an integer."
(let ((size (format-size format)))
(values
(decode-float-bits (read-integer size stream :byte-order byte-order)
:result-type result-type)
:result-type result-type :format format)
size)))

(defmacro read-float (format &key (stream *standard-input*) (result-type ''float) (byte-order :little-endian))
(if (keywordp format) ;; Is the format known at compile time?
(let ((size (format-size format)))
`(values (decode-float-bits (read-integer ,size ,stream :byte-order ,byte-order)
:format ,format :result-type ,result-type)
,size)
`(%read-float ,format ,stream ,result-type ,byte-order))))
,size))
`(%read-float ,format ,stream ,result-type ,byte-order)))

(defun %write-float (format fraction stream byte-order)
(let ((size (format-size format)))
Expand Down

0 comments on commit 901af41

Please sign in to comment.