master: Fix do-conset-elements for big-endian

stassats via Sbcl-commits <[email protected]> Sat, 01 Aug 2026 04:55:42 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  d28fd45be76a37fdb0106527aae61b5592f271b5 (commit)
      from  8619c09be14724c810e232315bc503a1d7f409e6 (commit)

- Log -----------------------------------------------------------------
commit d28fd45be76a37fdb0106527aae61b5592f271b5
Author: Stas Boukarev <[email protected]>
Date:   Sat Aug 1 07:38:51 2026 +0300

    Fix do-conset-elements for big-endian
---
 src/compiler/constraint.lisp | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/compiler/constraint.lisp b/src/compiler/constraint.lisp
index 492ea442b..fde14b0e6 100644
--- a/src/compiler/constraint.lisp
+++ b/src/compiler/constraint.lisp
@@ -530,14 +530,17 @@
                              (aref ,universe
                                    ;; COUNT-TRAILING-ZEROS produces slightly better code than
                                    ;; INTEGER-LENGTH.  Either iteration direction is ok.
-                                   (logior (sb-c::if-vop-existsp (:translate count-trailing-zeros)
-                                             (prog1 (count-trailing-zeros ,word)
-                                               ;; Clear the lowest 1 bit via the Brian Kernighan
-                                               ;; technique (allegedly)
-                                               (setq ,word (logand ,word (sb-vm::+-mod64 ,word -1))))
-                                             (let ((bit (1- (integer-length ,word))))
-                                               (setq ,word (logxor ,word (ash 1 bit)))
-                                               bit))
+                                   (logior (let ((bit
+                                                   (sb-c::if-vop-existsp (:translate count-trailing-zeros)
+                                                     (prog1 (count-trailing-zeros ,word)
+                                                       ;; Clear the lowest 1 bit via the Brian Kernighan
+                                                       ;; technique (allegedly)
+                                                       (setq ,word (logand ,word (sb-vm::+-mod64 ,word -1))))
+                                                     (let ((bit (1- (integer-length ,word))))
+                                                       (setq ,word (logxor ,word (ash 1 bit)))
+                                                       bit))))
+                                             #+little-endian bit
+                                             #+big-endian (- sb-vm:n-word-bits 1 bit))
                                            (* ,index sb-vm:n-word-bits))))))
                       ,@body)))
              finally (return ,result)))

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL