master: Check types for standalone byte, byte-size, byte-position
stassats via Sbcl-commits <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.cvs |
|---|---|
| Message-ID | <[email protected]> |
The branch "master" has been updated in SBCL:
via 8e5be95ed24654b4aac3ce2a717884694b85b2b2 (commit)
from 2afb32633b8e53c95d4268b26817a61a4ec2a891 (commit)
- Log -----------------------------------------------------------------
commit 8e5be95ed24654b4aac3ce2a717884694b85b2b2
Author: Stas Boukarev <[email protected]>
Date: Fri Apr 10 19:02:31 2026 +0300
Check types for standalone byte, byte-size, byte-position
Instead of just transforming them to cons, car, cdr.
---
src/compiler/srctran.lisp | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp
index 842064441..65b966915 100644
--- a/src/compiler/srctran.lisp
+++ b/src/compiler/srctran.lisp
@@ -700,12 +700,16 @@
(specifier-type '(eql t))))))
(define-source-transform byte (size position)
- (if (and (constantp size)
- (constantp position))
- `'(,(constant-form-value size) . ,(constant-form-value position))
- `(cons ,size ,position)))
-(define-source-transform byte-size (spec) `(car ,spec))
-(define-source-transform byte-position (spec) `(cdr ,spec))
+ (or (and (constantp size)
+ (constantp position)
+ (let ((size (constant-form-value size))
+ (position (constant-form-value position)))
+ (when (and (sb-xc:typep size 'bit-index)
+ (sb-xc:typep position 'bit-index))
+ `'(,size . ,position))))
+ `(cons (the bit-index ,size) (the bit-index ,position))))
+(define-source-transform byte-size (spec) `(the bit-index (car ,spec)))
+(define-source-transform byte-position (spec) `(the bit-index (cdr ,spec)))
(define-source-transform ldb-test (bytespec integer)
`(not (zerop (mask-field ,bytespec ,integer))))
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL