branch: elpa/vm
commit cdfd325bf9654d3460aa85503bcabfc079d67151
Author: Stefan Monnier <monn...@iro.umontreal.ca>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    Prefer `ash` over `lsh`
    
    `lsh` is deprecated since Emacs started using bignums, and as long as
    `n` is always non-negative and smaller than 2^24, `ash` should give the
    same result (except for Emacsen where fixnums are less than 25bits,
    like Emacs<19.29).
    
    * lisp/vcard.el (vcard-region-decode-base64): Avoid `lsh`
    lisp/vm-mime.el (vm-mime-qp-encode-region): Prefer `ash` to `lsh`
    * lisp/vm-mime.el (vm-mime-make-multipart-boundary):
    * lisp/vm-pgg.el (vm-pgg-make-multipart-boundary): Simplify.
---
 lisp/vcard.el   | 10 +++++-----
 lisp/vm-mime.el |  6 +++---
 lisp/vm-pgg.el  |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/vcard.el b/lisp/vcard.el
index 8c31761bba..3b3d8e6332 100644
--- a/lisp/vcard.el
+++ b/lisp/vcard.el
@@ -504,21 +504,21 @@ US domestic telephone numbers are replaced with 
international format."
         (delete-char 1)
         (cond ((char-equal c ?=)
                (if (= count 2)
-                   (insert (lsh n -10))
+                   (insert (ash n -10))
                  ;; count must be 3
-                 (insert (lsh n -16) (logand 255 (lsh n -8))))
+                 (insert (ash n -16) (logand 255 (ash n -8))))
                (delete-region (point) (point-max)))
               (t
                (setq n (+ n (aref vcard-region-decode-base64-table
                                   (vcard-char-to-int c))))
                (setq count (1+ count))
                (cond ((= count 4)
-                      (insert (logand 255 (lsh n -16))
-                              (logand 255 (lsh n -8))
+                      (insert (logand 255 (ash n -16))
+                              (logand 255 (ash n -8))
                               (logand 255 n))
                       (setq n 0 count 0))
                      (t
-                      (setq n (lsh n 6))))))))))
+                      (setq n (ash n 6))))))))))
 
 
 (defun vcard-split-string (string &optional separator limit)
diff --git a/lisp/vm-mime.el b/lisp/vm-mime.el
index 5b5c9791f9..f9449ad239 100644
--- a/lisp/vm-mime.el
+++ b/lisp/vm-mime.el
@@ -761,7 +761,7 @@ out includes base-64, quoted-printable, uuencode and CRLF 
conversion."
                         (and (= cols 0) (= char ?.)
                              (looking-at "\\.\\(\n\\|\\'\\)")))
                     (vm-insert-char ?= 1 nil work-buffer)
-                    (vm-insert-char (car (rassq (lsh (logand char 255) -4)
+                    (vm-insert-char (car (rassq (ash (logand char 255) -4)
                                                 hex-digit-alist))
                                     1 nil work-buffer)
                     (vm-insert-char (car (rassq (logand char 15)
@@ -5647,8 +5647,8 @@ Returns non-NIL value M is a plain message."
     (random t)
     (while (< i (length boundary))
       (aset boundary i (aref vm-mime-base64-alphabet
-                            (% (vm-abs (lsh (random) -8))
-                               (length vm-mime-base64-alphabet))))
+                            (random
+                             (length vm-mime-base64-alphabet))))
       (vm-increment i))
     boundary ))
 
diff --git a/lisp/vm-pgg.el b/lisp/vm-pgg.el
index 6fb98c8634..aaeda77fed 100644
--- a/lisp/vm-pgg.el
+++ b/lisp/vm-pgg.el
@@ -1063,8 +1063,8 @@ seed and thus creates the same boundery when called twice 
in a short period."
     (random)
     (while (< i (length boundary))
       (aset boundary i (aref vm-mime-base64-alphabet
-                            (% (vm-abs (lsh (random) -8))
-                               (length vm-mime-base64-alphabet))))
+                            (random
+                             (length vm-mime-base64-alphabet))))
       (vm-increment i))
     boundary))
 

Reply via email to