Skip to content

Commit

Permalink
quaviver: Add Clasp long-float/short-float
Browse files Browse the repository at this point in the history
  • Loading branch information
yitzchak committed Sep 26, 2024
1 parent 9f84ed0 commit 99e04a3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion code/ansi-test/test.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
(defvar *client-initargs*
'((burger-dybvig)
(schubfach)
#-ecl (dragonbox)))
#-(or ecl (and clasp long-float)) (dragonbox)))

(defun test (&rest args &key exit &allow-other-keys)
(setf args (remprop :exit args))
Expand Down
8 changes: 6 additions & 2 deletions code/bits-float-form.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#+quaviver/short-float
(defmethod bits-float-form ((float-type (eql 'short-float)) value)
#+clasp
`(ext:bits-to-short-float ,value)
#+clisp
`(ffi:with-foreign-object (u '(ffi:c-union (value ffi:single-float)
(bits ffi:uint32)))
Expand Down Expand Up @@ -126,9 +128,11 @@

#+quaviver/long-float
(defmethod bits-float-form ((float-type (eql 'long-float)) value)
#-quaviver/long-float-fallback
#+clasp
`(ext:bits-to-long-float ,value)
#+(and ecl (not quaviver/long-float-fallback))
`(system:bits-long-float ,value)
#+quaviver/long-float-fallback
#+(and ecl quaviver/long-float-fallback)
(alexandria:with-gensyms
(m n v)
`(let ((,v ,value))
Expand Down
8 changes: 6 additions & 2 deletions code/float-bits-form.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#+quaviver/short-float
(defmethod float-bits-form ((float-type (eql 'short-float)) value)
#+clasp
`(ext:short-float-to-bits ,value)
#+clisp
`(ffi:with-foreign-object (u '(ffi:c-union (value ffi:single-float)
(bits ffi:uint32)))
Expand Down Expand Up @@ -107,9 +109,11 @@

#+quaviver/long-float
(defmethod float-bits-form ((float-type (eql 'long-float)) value)
#-quaviver/long-float-fallback
#+clasp
`(ext:long-float-to-bits ,value)
#+(and ecl (not quaviver/long-float-fallback))
`(system:long-float-bits ,value)
#+quaviver/long-float-fallback
#+(and ecl quaviver/long-float-fallback)
(alexandria:with-gensyms
(m n)
`(ffi:with-foreign-object (,m 'long-float/uint128)
Expand Down
4 changes: 2 additions & 2 deletions code/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
#:exponent-word
#:define-number-parser))

#+clisp
#+(or clisp (and clasp short-float))
(pushnew :quaviver/short-float *features*)

#+(and ecl long-float)
#+(and (or clasp ecl) long-float)
(pushnew :quaviver/long-float *features*)

(defpackage #:quaviver.math
Expand Down

0 comments on commit 99e04a3

Please sign in to comment.