emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/xelb dd839c8946 2/2: Replace deprecated lsh with ash (#


From: ELPA Syncer
Subject: [elpa] externals/xelb dd839c8946 2/2: Replace deprecated lsh with ash (#20)
Date: Sun, 21 Jan 2024 00:59:18 -0500 (EST)

branch: externals/xelb
commit dd839c89463a4b6130dc90a2a6d44406c2c39155
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: GitHub <noreply@github.com>

    Replace deprecated lsh with ash (#20)
    
    The functions differ in their behavior for right shifts (negative argument
    COUNT) for negative values. The replaced calls are either left shifts or 
pass a
    positive value; as such they are not affected.
    
    * xcb-types.el: (xcb:-pack-*): `lsh' to `ash'. Argument positive (unsigned).
      (xcb:-unpack-*): `lsh' to `ash'. Left shifts.
      (xcb:-f*-to-binary*, xcb:-binary*-to-f*): `lsh' to `ash'. Argument 
positive.
    * xelb-gen (xelb-parse-bit): `lsh' to `ash'. Left shift.
      (xelb-parse-op): `lsh' to `ash'. Left shift.
    * xcb-keysyms.el: (xcb:keysyms:-update-modkeys): `lsh' to `ash'. Left shift.
      (xcb:keysyms:keycode->keysym): `lsh' to `ash'. Arguments modifiers and
      group-info positive?
---
 xcb-keysyms.el |   6 +--
 xcb-types.el   | 166 ++++++++++++++++++++++++++++-----------------------------
 xelb-gen       |   4 +-
 3 files changed, 88 insertions(+), 88 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index 922537e0e9..e20390ce3a 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -322,7 +322,7 @@ FIRST-KEYCODE and COUNT specify the keycode range to 
update."
           xcb:keysyms:shift-lock-mask 0
           xcb:keysyms:num-lock-mask 0)
     (dolist (row (number-sequence 3 7))
-      (let ((mask (lsh 1 row))
+      (let ((mask (ash 1 row))
             (col 0)
             found-alt-or-meta keycode keysym)
         (while (< col keycodes-per-modifier)
@@ -397,12 +397,12 @@ keycode.  The caller is responsible for checking which 
modifiers to use."
           (throw 'return '(0 . 0)))
         (setq group (if (null modifiers)
                         0
-                      (logand (lsh modifiers -13) #b11))) ;The 13, 14 bits.
+                      (logand (ash modifiers -13) #b11))) ;The 13, 14 bits.
         ;; Wrap group.
         (when (>= group group-number)
           (pcase (logand group-info #xC0) ;See <XKBstr.h>.
             (`xcb:xkb:GroupsWrap:RedirectIntoRange
-             (setq group (logand #xFF (lsh group-info -4))) ;See <XKBstr.h>.
+             (setq group (logand #xFF (ash group-info -4))) ;See <XKBstr.h>.
              ;; Check if it's also out of range.
              (when (>= group group-number)
                (setq group 0)))
diff --git a/xcb-types.el b/xcb-types.el
index 1ea817ad16..42ae7d1d7b 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -86,11 +86,11 @@ FORMAT-STRING is a string specifying the message to output, 
as in
 
 (defsubst xcb:-pack-u2 (value)
   "2 bytes unsigned integer => byte array (MSB first)."
-  (vector (logand (lsh value -8) #xFF) (logand value #xFF)))
+  (vector (logand (ash value -8) #xFF) (logand value #xFF)))
 
 (defsubst xcb:-pack-u2-lsb (value)
   "2 bytes unsigned integer => byte array (LSB first)."
-  (vector (logand value #xFF) (logand (lsh value -8) #xFF)))
+  (vector (logand value #xFF) (logand (ash value -8) #xFF)))
 
 (defsubst xcb:-pack-i2 (value)
   "2 bytes signed integer => byte array (MSB first)."
@@ -105,82 +105,82 @@ FORMAT-STRING is a string specifying the message to 
output, as in
 ;; Due to loss of significance of floating-point numbers, `xcb:-pack-u8' and
 ;; `xcb:-pack-u8-lsb' may return approximate results.
 (eval-and-compile
-  (if (/= 0 (lsh 1 32))
+  (if (/= 0 (ash 1 32))
       ;; 64 bit
       (progn
         (defsubst xcb:-pack-u4 (value)
           "4 bytes unsigned integer => byte array (MSB first, 64-bit)."
-          (vector (logand (lsh value -24) #xFF) (logand (lsh value -16) #xFF)
-                  (logand (lsh value -8) #xFF) (logand value #xFF)))
+          (vector (logand (ash value -24) #xFF) (logand (ash value -16) #xFF)
+                  (logand (ash value -8) #xFF) (logand value #xFF)))
         (defsubst xcb:-pack-u4-lsb (value)
           "4 byte unsigned integer => byte array (LSB first, 64-bit)."
           (vector (logand value #xFF)
-                  (logand (lsh value -8) #xFF)
-                  (logand (lsh value -16) #xFF)
-                  (logand (lsh value -24) #xFF)))
+                  (logand (ash value -8) #xFF)
+                  (logand (ash value -16) #xFF)
+                  (logand (ash value -24) #xFF)))
         (defsubst xcb:-pack-u8 (value)
           "8 bytes unsigned integer => byte array (MSB first)."
           (if (integerp value)
-              (vector (logand (lsh value -56) #xFF)
-                      (logand (lsh value -48) #xFF)
-                      (logand (lsh value -40) #xFF)
-                      (logand (lsh value -32) #xFF)
-                      (logand (lsh value -24) #xFF)
-                      (logand (lsh value -16) #xFF)
-                      (logand (lsh value -8) #xFF)
+              (vector (logand (ash value -56) #xFF)
+                      (logand (ash value -48) #xFF)
+                      (logand (ash value -40) #xFF)
+                      (logand (ash value -32) #xFF)
+                      (logand (ash value -24) #xFF)
+                      (logand (ash value -16) #xFF)
+                      (logand (ash value -8) #xFF)
                       (logand value #xFF))
             (let* ((msdw (min 4294967295. (truncate value 4294967296.)))
                    (lsdw (min 4294967295.
                               (truncate (- value (* msdw 4294967296.0))))))
-              (vector (logand (lsh msdw -24) #xFF) (logand (lsh msdw -16) #xFF)
-                      (logand (lsh msdw -8) #xFF) (logand msdw #xFF)
-                      (logand (lsh lsdw -24) #xFF) (logand (lsh lsdw -16) #xFF)
-                      (logand (lsh lsdw -8) #xFF) (logand lsdw #xFF)))))
+              (vector (logand (ash msdw -24) #xFF) (logand (ash msdw -16) #xFF)
+                      (logand (ash msdw -8) #xFF) (logand msdw #xFF)
+                      (logand (ash lsdw -24) #xFF) (logand (ash lsdw -16) #xFF)
+                      (logand (ash lsdw -8) #xFF) (logand lsdw #xFF)))))
         (defsubst xcb:-pack-u8-lsb (value)
           "8 bytes unsigned integer => byte array (LSB first)."
           (if (integerp value)
               (vector (logand value #xFF)
-                      (logand (lsh value -8) #xFF)
-                      (logand (lsh value -16) #xFF)
-                      (logand (lsh value -24) #xFF)
-                      (logand (lsh value -32) #xFF)
-                      (logand (lsh value -40) #xFF)
-                      (logand (lsh value -48) #xFF)
-                      (logand (lsh value -56) #xFF))
+                      (logand (ash value -8) #xFF)
+                      (logand (ash value -16) #xFF)
+                      (logand (ash value -24) #xFF)
+                      (logand (ash value -32) #xFF)
+                      (logand (ash value -40) #xFF)
+                      (logand (ash value -48) #xFF)
+                      (logand (ash value -56) #xFF))
             (let* ((msdw (min 4294967295. (truncate value 4294967296.)))
                    (lsdw (min 4294967295.
                               (truncate (- value (* msdw 4294967296.0))))))
-              (vector (logand lsdw #xFF) (logand (lsh lsdw -8) #xFF)
-                      (logand (lsh lsdw -16) #xFF) (logand (lsh lsdw -24) #xFF)
+              (vector (logand lsdw #xFF) (logand (ash lsdw -8) #xFF)
+                      (logand (ash lsdw -16) #xFF) (logand (ash lsdw -24) #xFF)
                       (logand msdw #xFF)
-                      (logand (lsh msdw -8) #xFF)
-                      (logand (lsh msdw -16) #xFF)
-                      (logand (lsh msdw -24) #xFF))))))
+                      (logand (ash msdw -8) #xFF)
+                      (logand (ash msdw -16) #xFF)
+                      (logand (ash msdw -24) #xFF))))))
     ;; 32 bit (30-bit actually; large numbers are represented as float type)
     (defsubst xcb:-pack-u4 (value)
       "4 bytes unsigned integer => byte array (MSB first, 32-bit)."
       (if (integerp value)
-          (vector (logand (lsh value -24) #xFF) (logand (lsh value -16) #xFF)
-                  (logand (lsh value -8) #xFF) (logand value #xFF))
+          (vector (logand (ash value -24) #xFF) (logand (ash value -16) #xFF)
+                  (logand (ash value -8) #xFF) (logand value #xFF))
         (let* ((msw (truncate value #x10000))
                (lsw (truncate (- value (* msw 65536.0)))))
-          (vector (logand (lsh msw -8) #xFF) (logand msw #xFF)
-                  (logand (lsh lsw -8) #xFF) (logand lsw #xFF)))))
+          (vector (logand (ash msw -8) #xFF) (logand msw #xFF)
+                  (logand (ash lsw -8) #xFF) (logand lsw #xFF)))))
     (defsubst xcb:-pack-u4-lsb (value)
       "4 bytes unsigned integer => byte array (LSB first, 32-bit)."
       (if (integerp value)
-          (vector (logand value #xFF) (logand (lsh value -8) #xFF)
-                  (logand (lsh value -16) #xFF) (logand (lsh value -24) #xFF))
+          (vector (logand value #xFF) (logand (ash value -8) #xFF)
+                  (logand (ash value -16) #xFF) (logand (ash value -24) #xFF))
         (let* ((msw (truncate value #x10000))
                (lsw (truncate (- value (* msw 65536.0)))))
-          (vector (logand lsw #xFF) (logand (lsh lsw -8) #xFF)
-                  (logand msw #xFF) (logand (lsh msw -8) #xFF)))))
+          (vector (logand lsw #xFF) (logand (ash lsw -8) #xFF)
+                  (logand msw #xFF) (logand (ash msw -8) #xFF)))))
     (defsubst xcb:-pack-u8 (value)
       "8 bytes unsigned integer => byte array (MSB first, 32-bit)."
       (if (integerp value)
           (vector 0 0 0 0
-                  (logand (lsh value -24) #xFF) (logand (lsh value -16) #xFF)
-                  (logand (lsh value -8) #xFF) (logand value #xFF))
+                  (logand (ash value -24) #xFF) (logand (ash value -16) #xFF)
+                  (logand (ash value -8) #xFF) (logand value #xFF))
         (let* ((msw (min #xFFFF (truncate value 281474976710656.)))
                (w1 (min #xFFFF
                         (truncate (setq value
@@ -190,15 +190,15 @@ FORMAT-STRING is a string specifying the message to 
output, as in
                         (truncate (setq value (- value (* w1 4294967296.0)))
                                   #x10000)))
                (lsw (min #xFFFF (truncate (- value (* w2 65536.0))))))
-          (vector (logand (lsh msw -8) #xFF) (logand msw #xFF)
-                  (logand (lsh w1 -8) #xFF) (logand w1 #xFF)
-                  (logand (lsh w2 -8) #xFF) (logand w2 #xFF)
-                  (logand (lsh lsw -8) #xFF) (logand lsw #xFF)))))
+          (vector (logand (ash msw -8) #xFF) (logand msw #xFF)
+                  (logand (ash w1 -8) #xFF) (logand w1 #xFF)
+                  (logand (ash w2 -8) #xFF) (logand w2 #xFF)
+                  (logand (ash lsw -8) #xFF) (logand lsw #xFF)))))
     (defsubst xcb:-pack-u8-lsb (value)
       "8 bytes unsigned integer => byte array (LSB first, 32-bit)."
       (if (integerp value)
-          (vector (logand value #xFF) (logand (lsh value -8) #xFF)
-                  (logand (lsh value -16) #xFF) (logand (lsh value -24) #xFF)
+          (vector (logand value #xFF) (logand (ash value -8) #xFF)
+                  (logand (ash value -16) #xFF) (logand (ash value -24) #xFF)
                   0 0 0 0)
         (let* ((msw (min #xFFFF (truncate value 281474976710656.)))
                (w1 (min #xFFFF
@@ -209,10 +209,10 @@ FORMAT-STRING is a string specifying the message to 
output, as in
                         (truncate (setq value (- value (* w1 4294967296.0)))
                                   #x10000)))
                (lsw (min #xFFFF (truncate (- value (* w2 65536.0))))))
-          (vector (logand lsw #xFF) (logand (lsh lsw -8) #xFF)
-                  (logand w2 #xFF) (logand (lsh w2 -8) #xFF)
-                  (logand w1 #xFF) (logand (lsh w1 -8) #xFF)
-                  (logand msw #xFF) (logand (lsh msw -8) #xFF)))))))
+          (vector (logand lsw #xFF) (logand (ash lsw -8) #xFF)
+                  (logand w2 #xFF) (logand (ash w2 -8) #xFF)
+                  (logand w1 #xFF) (logand (ash w1 -8) #xFF)
+                  (logand msw #xFF) (logand (ash msw -8) #xFF)))))))
 
 (defsubst xcb:-pack-i4 (value)
   "4 bytes signed integer => byte array (MSB first)."
@@ -239,11 +239,11 @@ FORMAT-STRING is a string specifying the message to 
output, as in
 
 (defsubst xcb:-unpack-u2 (data offset)
   "Byte array => 2 bytes unsigned integer (MSB first)."
-  (logior (lsh (aref data offset) 8) (aref data (1+ offset))))
+  (logior (ash (aref data offset) 8) (aref data (1+ offset))))
 
 (defsubst xcb:-unpack-u2-lsb (data offset)
   "Byte array => 2 bytes unsigned integer (LSB first)."
-  (logior (aref data offset) (lsh (aref data (1+ offset)) 8)))
+  (logior (aref data offset) (ash (aref data (1+ offset)) 8)))
 
 (defsubst xcb:-unpack-i2 (data offset)
   "Byte array => 2 bytes signed integer (MSB first)."
@@ -262,55 +262,55 @@ FORMAT-STRING is a string specifying the message to 
output, as in
 ;; Due to loss of significance of floating-point numbers, `xcb:-unpack-u8' and
 ;; `xcb:-unpack-u8-lsb' may return approximate results.
 (eval-and-compile
-  (if (/= 0 (lsh 1 32))
+  (if (/= 0 (ash 1 32))
       ;; 64-bit
       (progn
         (defsubst xcb:-unpack-u4 (data offset)
           "Byte array => 4 bytes unsigned integer (MSB first, 64-bit)."
-          (logior (lsh (aref data offset) 24) (lsh (aref data (1+ offset)) 16)
-                  (lsh (aref data (+ offset 2)) 8) (aref data (+ offset 3))))
+          (logior (ash (aref data offset) 24) (ash (aref data (1+ offset)) 16)
+                  (ash (aref data (+ offset 2)) 8) (aref data (+ offset 3))))
         (defsubst xcb:-unpack-u4-lsb (data offset)
           "Byte array => 4 bytes unsigned integer (LSB first, 64-bit)."
-          (logior (aref data offset) (lsh (aref data (1+ offset)) 8)
-                  (lsh (aref data (+ offset 2)) 16)
-                  (lsh (aref data (+ offset 3)) 24)))
+          (logior (aref data offset) (ash (aref data (1+ offset)) 8)
+                  (ash (aref data (+ offset 2)) 16)
+                  (ash (aref data (+ offset 3)) 24)))
         (defsubst xcb:-unpack-u8 (data offset)
           "Byte array => 8 bytes unsigned integer (MSB first)."
           (let ((msb (aref data offset)))
-            (+ (if (> msb 31) (* msb 72057594037927936.0) (lsh msb 56))
-               (logior (lsh (aref data (1+ offset)) 48)
-                       (lsh (aref data (+ offset 2)) 40)
-                       (lsh (aref data (+ offset 3)) 32)
-                       (lsh (aref data (+ offset 4)) 24)
-                       (lsh (aref data (+ offset 5)) 16)
-                       (lsh (aref data (+ offset 6)) 8)
+            (+ (if (> msb 31) (* msb 72057594037927936.0) (ash msb 56))
+               (logior (ash (aref data (1+ offset)) 48)
+                       (ash (aref data (+ offset 2)) 40)
+                       (ash (aref data (+ offset 3)) 32)
+                       (ash (aref data (+ offset 4)) 24)
+                       (ash (aref data (+ offset 5)) 16)
+                       (ash (aref data (+ offset 6)) 8)
                        (aref data (+ offset 7))))))
         (defsubst xcb:-unpack-u8-lsb (data offset)
           "Byte array => 8 bytes unsigned integer (LSB first)."
           (let ((msb (aref data (+ offset 7))))
-            (+ (if (> msb 31) (* msb 72057594037927936.0) (lsh msb 56))
-               (logior (lsh (aref data (+ offset 6)) 48)
-                       (lsh (aref data (+ offset 5)) 40)
-                       (lsh (aref data (+ offset 4)) 32)
-                       (lsh (aref data (+ offset 3)) 24)
-                       (lsh (aref data (+ offset 2)) 16)
-                       (lsh (aref data (1+ offset)) 8)
+            (+ (if (> msb 31) (* msb 72057594037927936.0) (ash msb 56))
+               (logior (ash (aref data (+ offset 6)) 48)
+                       (ash (aref data (+ offset 5)) 40)
+                       (ash (aref data (+ offset 4)) 32)
+                       (ash (aref data (+ offset 3)) 24)
+                       (ash (aref data (+ offset 2)) 16)
+                       (ash (aref data (1+ offset)) 8)
                        (aref data offset))))))
     ;; 32-bit (30-bit actually; large numbers are represented as float type)
     (defsubst xcb:-unpack-u4 (data offset)
       "Byte array => 4 bytes unsigned integer (MSB first, 32-bit)."
       (let ((msb (aref data offset)))
-        (+ (if (> msb 31) (* msb 16777216.0) (lsh msb 24))
-           (logior (lsh (aref data (1+ offset)) 16)
-                   (lsh (aref data (+ offset 2)) 8)
+        (+ (if (> msb 31) (* msb 16777216.0) (ash msb 24))
+           (logior (ash (aref data (1+ offset)) 16)
+                   (ash (aref data (+ offset 2)) 8)
                    (aref data (+ offset 3))))))
     (defsubst xcb:-unpack-u4-lsb (data offset)
       "Byte array => 4 bytes unsigned integer (LSB first, 32-bit)."
       (let ((msb (aref data (+ offset 3))))
-        (+ (if (> msb 31) (* msb 16777216.0) (lsh msb 24))
+        (+ (if (> msb 31) (* msb 16777216.0) (ash msb 24))
            (logior (aref data offset)
-                   (lsh (aref data (1+ offset)) 8)
-                   (lsh (aref data (+ offset 2)) 16)))))
+                   (ash (aref data (1+ offset)) 8)
+                   (ash (aref data (+ offset 2)) 16)))))
     (defsubst xcb:-unpack-u8 (data offset)
       "Byte array => 8 bytes unsigned integer (MSB first, 32-bit)."
       (+ (* (aref data offset) 72057594037927936.0)
@@ -318,8 +318,8 @@ FORMAT-STRING is a string specifying the message to output, 
as in
          (* (aref data (+ offset 2)) 1099511627776.0)
          (* (aref data (+ offset 3)) 4294967296.0)
          (* (aref data (+ offset 4)) 16777216.0)
-         (logior (lsh (aref data (+ offset 5)) 16)
-                 (lsh (aref data (+ offset 6)) 8)
+         (logior (ash (aref data (+ offset 5)) 16)
+                 (ash (aref data (+ offset 6)) 8)
                  (aref data (+ offset 7)))))
     (defsubst xcb:-unpack-u8-lsb (data offset)
       "Byte array => 8 bytes unsigned integer (LSB first, 32-bit)."
@@ -328,8 +328,8 @@ FORMAT-STRING is a string specifying the message to output, 
as in
          (* (aref data (+ offset 5)) 1099511627776.0)
          (* (aref data (+ offset 4)) 4294967296.0)
          (* (aref data (+ offset 3)) 16777216.0)
-         (logior (lsh (aref data (+ offset 2)) 16)
-                 (lsh (aref data (1+ offset)) 8)
+         (logior (ash (aref data (+ offset 2)) 16)
+                 (ash (aref data (1+ offset)) 8)
                  (aref data offset))))))
 
 (defsubst xcb:-unpack-i4 (data offset)
diff --git a/xelb-gen b/xelb-gen
index 54e3957bce..0d064135a2 100755
--- a/xelb-gen
+++ b/xelb-gen
@@ -650,7 +650,7 @@ The `combine-adjacent' attribute is simply ignored."
       ("*" `(* ,x ,y))
       ("/" `(/ ,x ,y))
       ("&" `(logand ,x ,y))
-      ("<<" `(lsh ,x ,y))
+      ("<<" `(ash ,x ,y))
       (x (error "Unsupported operator: `%s'" x)))))
 
 (defun xelb-parse-fieldref (node)
@@ -676,7 +676,7 @@ The `combine-adjacent' attribute is simply ignored."
   "Parse <bit>."
   (let ((bit (string-to-number (xelb-node-subnode node))))
     (cl-assert (<= 0 bit 31))
-    (lsh 1 bit)))
+    (ash 1 bit)))
 
 (defun xelb-parse-enumref (node)
   "Parse <enumref>."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]