Skip to content

Commit

Permalink
math: move feature tests outside of DEFTYPE WORD
Browse files Browse the repository at this point in the history
When DEFTYPE WORD contains the feature tests for
QUAVIVER/BIGNUM-ELISION, ECL and Clasp seem to have trouble
understanding the type declarations in Dragonbox.
  • Loading branch information
paulapatience committed Jun 29, 2024
1 parent 4ae879e commit a8ea048
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions code/math/implementation.lisp
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
(in-package #:quaviver/math)

#+quaviver/bignum-elision
(deftype word (arithmetic-size &optional (count 1))
#+quaviver/bignum-elision
(ecase arithmetic-size
(32 (case count
(1 `(unsigned-byte 32))
(2 `(unsigned-byte 64))
(otherwise `(simple-array (unsigned-byte 64) (,(ceiling count 2))))))
(64 (if (eql count 1)
`(unsigned-byte 64)
`(simple-array (unsigned-byte 64) (,count))))
(128 `(simple-array (unsigned-byte 64) (,(ash count 1)))))
#-quaviver/bignum-elision
`(unsigned-byte ,(* arithmetic-size count)))
(ecase arithmetic-size
(32 (case count
(1 `(unsigned-byte 32))
(2 `(unsigned-byte 64))
(otherwise `(simple-array (unsigned-byte 64) (,(ceiling count 2))))))
(64 (if (eql count 1)
`(unsigned-byte 64)
`(simple-array (unsigned-byte 64) (,count))))
(128 `(simple-array (unsigned-byte 64) (,(ash count 1))))))

#-quaviver/bignum-elision
(deftype word (arithmetic-size &optional (count 1))
`(unsigned-byte ,(* arithmetic-size count)))

;;; Bignum elision
;;;
Expand Down

0 comments on commit a8ea048

Please sign in to comment.