Re: master: Defensively code in type-width-in-bits
Stas Boukarev <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.cvs,gmane.lisp.steel-bank.devel |
|---|---|
| Message-ID | <CAF63=11dpptY-OEqzgc=NtixsFTkDNpt-BZiY-4DJ7gSDZskgw@mail.gmail.com> |
And taking interval-high makes it unsigned-type-width-in-bits. There's already SB-C::INTEGER-TYPE-LENGTH, but it doesn't employ type-approximate-interval. On Sun, Apr 19, 2026 at 7:07 PM Stas Boukarev <[email protected]> wrote: > > I think type-approximate-interval should be used instead. (Which can > still return NIL, and interval-high might also be NIL). > > On Sun, Apr 19, 2026 at 7:01 PM snuglas via Sbcl-commits > <[email protected]> wrote: > > > > The branch "master" has been updated in SBCL: > > via 566883ab44ee474bfa5b12a00e8b6aeb2d946fdb (commit) > > from c9317d951a80eab801e3a93e4edb346dc54fa302 (commit) > > > > - Log ----------------------------------------------------------------- > > commit 566883ab44ee474bfa5b12a00e8b6aeb2d946fdb > > Author: Douglas Katzman <[email protected]> > > Date: Sun Apr 19 11:59:56 2026 -0400 > > > > Defensively code in type-width-in-bits > > > > The receiving logic already potentially expected NIL > > --- > > src/compiler/generic/utils.lisp | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/src/compiler/generic/utils.lisp b/src/compiler/generic/utils.lisp > > index 85e6f5533..cdff56dab 100644 > > --- a/src/compiler/generic/utils.lisp > > +++ b/src/compiler/generic/utils.lisp > > @@ -593,7 +593,8 @@ > > ;; Return (integer-length upper-bound) of numeric type. This is NOT a theoretical > > ;; smallest N bits needed to encode an element of type in a packed representation > > ;; (e.g. the interval 5..8 _could_ be stored in 2 bits) but we don't do that. > > - (integer-length (sb-c::interval-high (sb-c::numeric-type->interval ctype)))) > > + (if (typep ctype 'numeric-union-type) > > + (integer-length (sb-c::interval-high (sb-c::numeric-type->interval ctype))))) > > > > (defun env-system-tlab-p (env) > > #-system-tlabs (declare (ignore env)) > > > > ----------------------------------------------------------------------- > > > > > > hooks/post-receive > > -- > > SBCL > > > > > > _______________________________________________ > > Sbcl-commits mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/sbcl-commits _______________________________________________ Sbcl-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sbcl-commits