aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/gnus/hex-util.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/gnus/hex-util.el b/lisp/gnus/hex-util.el
index 6a10e3d2449..981516e4b2a 100644
--- a/lisp/gnus/hex-util.el
+++ b/lisp/gnus/hex-util.el
@@ -29,14 +29,14 @@
29 29
30(eval-when-compile 30(eval-when-compile
31 (defmacro hex-char-to-num (chr) 31 (defmacro hex-char-to-num (chr)
32 (` (let ((chr (, chr))) 32 `(let ((chr ,chr))
33 (cond 33 (cond
34 ((and (<= ?a chr)(<= chr ?f)) (+ (- chr ?a) 10)) 34 ((and (<= ?a chr)(<= chr ?f)) (+ (- chr ?a) 10))
35 ((and (<= ?A chr)(<= chr ?F)) (+ (- chr ?A) 10)) 35 ((and (<= ?A chr)(<= chr ?F)) (+ (- chr ?A) 10))
36 ((and (<= ?0 chr)(<= chr ?9)) (- chr ?0)) 36 ((and (<= ?0 chr)(<= chr ?9)) (- chr ?0))
37 (t (error "Invalid hexadecimal digit `%c'" chr)))))) 37 (t (error "Invalid hexadecimal digit `%c'" chr)))))
38 (defmacro num-to-hex-char (num) 38 (defmacro num-to-hex-char (num)
39 (` (aref "0123456789abcdef" (, num))))) 39 `(aref "0123456789abcdef" ,num)))
40 40
41(defun decode-hex-string (string) 41(defun decode-hex-string (string)
42 "Decode hexadecimal STRING to octet string." 42 "Decode hexadecimal STRING to octet string."
@@ -44,9 +44,9 @@
44 (dst (make-string (/ len 2) 0)) 44 (dst (make-string (/ len 2) 0))
45 (idx 0)(pos 0)) 45 (idx 0)(pos 0))
46 (while (< pos len) 46 (while (< pos len)
47;;; logior and lsh are not byte-coded. 47 ;; logior and lsh are not byte-coded.
48;;; (aset dst idx (logior (lsh (hex-char-to-num (aref string pos)) 4) 48 ;; (aset dst idx (logior (lsh (hex-char-to-num (aref string pos)) 4)
49;;; (hex-char-to-num (aref string (1+ pos))))) 49 ;; (hex-char-to-num (aref string (1+ pos)))))
50 (aset dst idx (+ (* (hex-char-to-num (aref string pos)) 16) 50 (aset dst idx (+ (* (hex-char-to-num (aref string pos)) 16)
51 (hex-char-to-num (aref string (1+ pos))))) 51 (hex-char-to-num (aref string (1+ pos)))))
52 (setq idx (1+ idx) 52 (setq idx (1+ idx)
@@ -59,11 +59,11 @@
59 (dst (make-string (* len 2) 0)) 59 (dst (make-string (* len 2) 0))
60 (idx 0)(pos 0)) 60 (idx 0)(pos 0))
61 (while (< pos len) 61 (while (< pos len)
62;;; logand and lsh are not byte-coded. 62 ;; logand and lsh are not byte-coded.
63;;; (aset dst idx (num-to-hex-char (logand (lsh (aref string pos) -4) 15))) 63 ;; (aset dst idx (num-to-hex-char (logand (lsh (aref string pos) -4) 15)))
64 (aset dst idx (num-to-hex-char (/ (aref string pos) 16))) 64 (aset dst idx (num-to-hex-char (/ (aref string pos) 16)))
65 (setq idx (1+ idx)) 65 (setq idx (1+ idx))
66;;; (aset dst idx (num-to-hex-char (logand (aref string pos) 15))) 66 ;; (aset dst idx (num-to-hex-char (logand (aref string pos) 15)))
67 (aset dst idx (num-to-hex-char (% (aref string pos) 16))) 67 (aset dst idx (num-to-hex-char (% (aref string pos) 16)))
68 (setq idx (1+ idx) 68 (setq idx (1+ idx)
69 pos (1+ pos))) 69 pos (1+ pos)))
@@ -71,5 +71,5 @@
71 71
72(provide 'hex-util) 72(provide 'hex-util)
73 73
74;;; arch-tag: fe8aaa79-6c86-400e-813f-5a8cc4cb3859 74;; arch-tag: fe8aaa79-6c86-400e-813f-5a8cc4cb3859
75;;; hex-util.el ends here 75;;; hex-util.el ends here