Skip to content

Commit

Permalink
math: adjust WORD type to use bignums on 128 bit arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
paulapatience committed Jun 30, 2024
1 parent 799348a commit 3583fe7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions code/math/implementation.lisp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
(in-package #:quaviver/math)

(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)))
#+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 `(unsigned-byte ,(* arithmetic-size count))))
#-quaviver/bignum-elision
`(unsigned-byte ,(* arithmetic-size count)))

;;; Bignum elision
;;;
Expand Down

0 comments on commit 3583fe7

Please sign in to comment.