Skip to content

Commit

Permalink
dragonbox: constrain EXPONENT, -K, BETA to sb32
Browse files Browse the repository at this point in the history
This addresses some compiler notes reported by SBCL.

* code/dragonbox/implementation.lisp (%nearest, %directed): Declare
EXPONENT, -K and BETA as (SIGNED-BYTE 32) rather than FIXNUM.
  • Loading branch information
paulapatience committed Jun 28, 2024
1 parent 242ec5c commit eb698a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions code/dragonbox/implementation.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
(sign 0)
(2fc 0))
(declare ((unsigned-byte ,arithmetic-size) significand 2fc)
((or fixnum keyword) exponent)
((or (signed-byte 32) keyword) exponent)
((integer -1 1) sign))
(multiple-value-setq (significand exponent sign)
(quaviver:float-integer ,client 2 ,value))
Expand Down Expand Up @@ -427,7 +427,7 @@
(ash (the (unsigned-byte ,expt10-size)
(+ expt10 (ash expt10 ,(- significand-size))))
(- (- ,expt10-size ,significand-size beta))))))
(declare (fixnum -k beta)
(declare ((signed-byte 32) -k beta)
((unsigned-byte ,expt10-size) expt10)
((unsigned-byte ,arithmetic-size) xi zi))
(when (and (not include-right-endpoint-p)
Expand Down Expand Up @@ -480,7 +480,7 @@
(zi 0)
(zi-integer-p nil)
(r 0))
(declare (fixnum -k beta)
(declare ((signed-byte 32) -k beta)
((unsigned-byte ,expt10-size) expt10)
((unsigned-byte ,arithmetic-size) deltai zi r)
(boolean zi-integer-p))
Expand Down Expand Up @@ -558,7 +558,7 @@
(sign 0)
(2fc 0))
(declare ((unsigned-byte ,arithmetic-size) significand 2fc)
((or fixnum keyword) exponent)
((or (signed-byte 32) keyword) exponent)
((integer -1 1) sign))
(multiple-value-setq (significand exponent sign)
(quaviver:float-integer ,client 2 ,value))
Expand All @@ -579,7 +579,7 @@
(xi 0)
(xi-integer-p nil)
(r 0))
(declare (fixnum -k beta)
(declare ((signed-byte 32) -k beta)
((unsigned-byte ,expt10-size) expt10)
((unsigned-byte ,arithmetic-size) deltai xi r)
(boolean xi-integer-p))
Expand Down Expand Up @@ -635,7 +635,7 @@
(zi (nth-value 0 (compute-mul (ash 2fc beta) expt10
,arithmetic-size ,expt10-size)))
(r 0))
(declare (fixnum -k beta)
(declare ((signed-byte 32) -k beta)
((unsigned-byte ,expt10-size) expt10)
((unsigned-byte ,arithmetic-size) deltai zi r))
;; Step 2: Try larger divisor; remove trailing zeros if necessary
Expand Down

0 comments on commit eb698a0

Please sign in to comment.