Use ash instead of lsh

* lisp/files.el (file-modes-number-to-symbolic):
* lisp/image/exif.el (exif--direct-ascii-value):
* lisp/term/haiku-win.el (defun):
* lisp/x-dnd.el (x-dnd-handle-xdnd, x-dnd-handle-motif):
`lsh` is slower and has confusing semantics; avoid.
This commit is contained in:
Mattias Engdegård 2022-07-19 13:57:47 +02:00
parent ac1d15e95c
commit e536fb0851
4 changed files with 7 additions and 7 deletions

View file

@ -8337,7 +8337,7 @@ such as `?d' for a directory, or `?l' for a symbolic link and will override
the leading `-' char."
(string
(or filetype
(pcase (lsh mode -12)
(pcase (ash mode -12)
;; POSIX specifies that the file type is included in st_mode
;; and provides names for the file types but values only for
;; the permissions (e.g., S_IWOTH=2).

View file

@ -261,9 +261,9 @@ VALUE is an integer representing BYTES characters."
(set-buffer-multibyte nil)
(if le
(dotimes (i bytes)
(insert (logand (lsh value (* i -8)) 255)))
(insert (logand (ash value (* i -8)) 255)))
(dotimes (i bytes)
(insert (logand (lsh value (* (- (1- bytes) i) -8)) 255))))
(insert (logand (ash value (* (- (1- bytes) i) -8)) 255))))
(insert 0)
(buffer-string)))

View file

@ -188,7 +188,7 @@ VALUE as a unibyte string, or nil if VALUE was not a string."
(error "Out of range octet: %d" octet))
(setq value
(logior value
(lsh octet
(ash octet
(- (* (1- (length string)) 8)
offset))))
(setq offset (+ offset 8))))

View file

@ -825,8 +825,8 @@ MESSAGE is the type of the ClientMessage that was sent."
(when (windowp (posn-window (event-start event)))
(let ((flags (aref data 1))
(version (aref state 6)))
(when (not (zerop (logand (lsh flags -10) 1)))
(let* ((button (+ 4 (logand (lsh flags -8) #x3)))
(when (not (zerop (logand (ash flags -10) 1)))
(let* ((button (+ 4 (logand (ash flags -8) #x3)))
(count (or (and (>= version 1)
(x-dnd-note-click button
(aref data 3)))
@ -1086,7 +1086,7 @@ Return a vector of atoms containing the selection targets."
(defun x-dnd-handle-motif (event frame window _message-atom _format data)
(let* ((message-type (cdr (assoc (logand (aref data 0) #x3f)
x-dnd-motif-message-types)))
(initiator-p (eq (lsh (aref data 0) -7) 0))
(initiator-p (eq (ash (aref data 0) -7) 0))
(source-byteorder (aref data 1))
(my-byteorder (byteorder))
(source-flags (x-dnd-get-motif-value data 2 2 source-byteorder))