From e424f308f74eb81f458e50508c3c5f3cb2848d23 Mon Sep 17 00:00:00 2001 From: "Tarn W. Burton" Date: Wed, 31 Jul 2024 07:29:26 -0400 Subject: [PATCH] quaviver: add fallbacks when short-float or long-float unavailable --- code/bits-float-form.lisp | 8 ++++++++ code/bits-float.lisp | 8 ++++++++ code/float-bits-form.lisp | 8 ++++++++ code/float-internal-integer-form.lisp | 8 ++++++++ code/integer-float.lisp | 10 ++++++++++ code/internal-integer-float-form.lisp | 8 ++++++++ 6 files changed, 50 insertions(+) diff --git a/code/bits-float-form.lisp b/code/bits-float-form.lisp index 28cf846e..726704bf 100644 --- a/code/bits-float-form.lisp +++ b/code/bits-float-form.lisp @@ -25,6 +25,10 @@ (storage-size 'short-float)))) (coerce (ffi:slot (ffi:foreign-value u) 'value) 'short-float))) +#-quaviver/short-float +(defmethod bits-float-form ((float-type (eql 'short-float)) value) + (bits-float-form 'single-float value)) + (defmethod bits-float-form ((float-type (eql 'single-float)) value) #+abcl `(system:make-single-float ,value) @@ -137,3 +141,7 @@ (ffi:get-slot-value ,m 'long-float/uint128 'u) ,n)) (ffi:get-slot-value ,m 'long-float/uint128 'f))))) + +#-quaviver/long-float +(defmethod bits-float-form ((float-type (eql 'long-float)) value) + (bits-float-form 'double-float value)) diff --git a/code/bits-float.lisp b/code/bits-float.lisp index f377599c..87b45dd0 100644 --- a/code/bits-float.lisp +++ b/code/bits-float.lisp @@ -7,6 +7,10 @@ (defmethod bits-float ((float-type (eql 'short-float)) value) (%bits-float short-float value)) +#-quaviver/short-float +(defmethod bits-float ((float-type (eql 'short-float)) value) + (%bits-float single-float value)) + (defmethod bits-float ((float-type (eql 'single-float)) value) (%bits-float single-float value)) @@ -16,3 +20,7 @@ #+quaviver/long-float (defmethod bits-float ((float-type (eql 'long-float)) value) (%bits-float long-float value)) + +#-quaviver/long-float +(defmethod bits-float ((float-type (eql 'long-float)) value) + (%bits-float double-float value)) diff --git a/code/float-bits-form.lisp b/code/float-bits-form.lisp index a933b5ea..6c424a26 100644 --- a/code/float-bits-form.lisp +++ b/code/float-bits-form.lisp @@ -10,6 +10,10 @@ ,(- (storage-size 'short-float) (storage-size 'single-float))))) +#-quaviver/short-float +(defmethod float-bits-form ((float-type (eql 'short-float)) value) + (float-bits-form 'single-float value)) + (defmethod float-bits-form ((float-type (eql 'single-float)) value) #+abcl `(system:single-float-bits ,value) @@ -115,3 +119,7 @@ (logior (ffi:deref-array ,n '(:array :uint64-t 2) 0) (ash (ffi:deref-array ,n '(:array :uint64-t 2) 1) 64))))))) + +#-quaviver/long-float +(defmethod float-bits-form ((float-type (eql 'long-float)) value) + (float-bits-form 'double-float value)) diff --git a/code/float-internal-integer-form.lisp b/code/float-internal-integer-form.lisp index 4ad3f5d1..eb7e4be0 100644 --- a/code/float-internal-integer-form.lisp +++ b/code/float-internal-integer-form.lisp @@ -72,6 +72,10 @@ (defmethod float-internal-integer-form ((float-type (eql 'short-float)) value) `(float-internal-integer/short-float ,value)) +#-quaviver/short-float +(defmethod float-internal-integer-form ((float-type (eql 'short-float)) value) + `(float-internal-integer/single-float ,value)) + (defmethod float-internal-integer-form ((float-type (eql 'single-float)) value) `(float-internal-integer/single-float ,value)) @@ -82,6 +86,10 @@ (defmethod float-internal-integer-form ((float-type (eql 'long-float)) value) `(float-internal-integer/long-float ,value)) +#-quaviver/long-float +(defmethod float-internal-integer-form ((float-type (eql 'long-float)) value) + `(float-internal-integer/double-float ,value)) + (defmethod float-internal-integer-form (float-type value) (declare (ignore float-type)) `(integer-decode-float ,value)) diff --git a/code/integer-float.lisp b/code/integer-float.lisp index f7987204..5234829e 100644 --- a/code/integer-float.lisp +++ b/code/integer-float.lisp @@ -21,3 +21,13 @@ (client (float-type (eql 'long-float)) (base (eql 2)) significand exponent sign) (declare (ignore client)) (internal-integer-float/long-float significand exponent sign)) + +#-quaviver/short-float +(defmethod integer-float + (client (float-type (eql 'short-float)) base significand exponent sign) + (integer-float client 'single-float base significand exponent sign)) + +#-quaviver/long-float +(defmethod integer-float + (client (float-type (eql 'long-float)) base significand exponent sign) + (integer-float client 'double-float base significand exponent sign)) diff --git a/code/internal-integer-float-form.lisp b/code/internal-integer-float-form.lisp index 1b1f5b8a..adc4030a 100644 --- a/code/internal-integer-float-form.lisp +++ b/code/internal-integer-float-form.lisp @@ -100,6 +100,10 @@ (defmethod internal-integer-float-form ((float-type (eql 'short-float)) significand exponent sign) `(internal-integer-float/short-float ,significand ,exponent ,sign)) +#-quaviver/short-float +(defmethod internal-integer-float-form ((float-type (eql 'short-float)) significand exponent sign) + `(internal-integer-float/single-float ,significand ,exponent ,sign)) + (defmethod internal-integer-float-form ((float-type (eql 'single-float)) significand exponent sign) `(internal-integer-float/single-float ,significand ,exponent ,sign)) @@ -109,3 +113,7 @@ #+quaviver/long-float (defmethod internal-integer-float-form ((float-type (eql 'long-float)) significand exponent sign) `(internal-integer-float/long-float ,significand ,exponent ,sign)) + +#-quaviver/long-float +(defmethod internal-integer-float-form ((float-type (eql 'long-float)) significand exponent sign) + `(internal-integer-float/double-float ,significand ,exponent ,sign))