[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/base32 95af9632f3 070/103: Wrap lsh in base32.el to suppre
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/base32 95af9632f3 070/103: Wrap lsh in base32.el to suppress misleading lsh vs ash warning |
Date: |
Sat, 10 Feb 2024 13:00:09 -0500 (EST) |
branch: elpa/base32
commit 95af9632f36319475b95ed21b14239c74523e024
Author: Vivek Das Mohapatra <vivek@collabora.com>
Commit: Vivek Das Mohapatra <vivek@collabora.com>
Wrap lsh in base32.el to suppress misleading lsh vs ash warning
---
base32.el | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/base32.el b/base32.el
index 54ed5f9133..00c5ffa44d 100644
--- a/base32.el
+++ b/base32.el
@@ -20,6 +20,11 @@
possible 5bit value (0-31) at that index, plus a padding character
at index 32.")
+(defun base32-lsh (v c)
+ "Suppress opinionated (and in our case wrong) warning about ’lsh’."
+ (with-suppressed-warnings ((suspicious lsh))
+ (lsh v c)))
+
(defun base32-thesaurus (&optional dictionary)
"Make a reverse lookup base32 for DICTIONARY.
The 5bit value corresponding to each encoding character is stored at the
@@ -49,8 +54,8 @@ Dictionary should match ‘base32-dictionary’ in format."
;; discard the 0th and 1st bits).
;; then right shift by 3 bits so we have the highest 3
;; bits set to zero (since we want a 5-bit value):
- (setq result (logand #xff (lsh op-char start-bit))
- result (logand #xff (lsh result -3)))
+ (setq result (logand #xff (base32-lsh op-char start-bit))
+ result (logand #xff (base32-lsh result -3)))
;; now check to see if we need some bits from the next vyte:
(when (> end-bit 7)
(setq end-bit (- end-bit 7) ;; work out the first bit we don't want
@@ -59,7 +64,7 @@ Dictionary should match ‘base32-dictionary’ in format."
;; eg if we wanted 2 bits from byte 0 (rightmost bits 6 and 7)
;; then we want bits 8, 9, and 10, aka bits 0, 1, and 2
;; from byte 1. which means we discard 5 bits by right shifting:
- r2 (logand #xff (lsh op-char (- end-bit 8)))
+ r2 (logand #xff (base32-lsh op-char (- end-bit 8)))
;; combine the wanted bits:
result (logior (logand result #x1f) (logand r2 #x1f))))
result))
@@ -76,8 +81,8 @@ Dictionary should match ‘base32-dictionary’ in format."
;; but lefwards by 3 bits because we're writing into the start
;; of an 8-bit slot.
;; mask is five contiguous set bits starting at the same offset
- (setq set-bits (logand #xff (lsh value (- 0 -3 start-bit)))
- mask (logand #xff (lsh #x1f (- 0 -3 start-bit)))
+ (setq set-bits (logand #xff (base32-lsh value (- 0 -3 start-bit)))
+ mask (logand #xff (base32-lsh #x1f (- 0 -3 start-bit)))
;; turn off the masked bits in the target
op-char (logand op-char (lognot mask))
;; set the target bits to set-bits
@@ -89,7 +94,7 @@ Dictionary should match ‘base32-dictionary’ in format."
;; number of bits from value we have dealt with
discard (- 12 end-bit)
;; discard the 3 dead bits and the dealt with bits
- set-bits (logand #xff (lsh value (+ 3 discard)))
+ set-bits (logand #xff (base32-lsh value (+ 3 discard)))
op-char (logand #xff (aref str start-char))
op-char (logand op-char (lognot #xf8))
op-char (logior op-char set-bits))
- [nongnu] elpa/base32 4708406887 067/103: Add comm to package's keywords, (continued)
- [nongnu] elpa/base32 4708406887 067/103: Add comm to package's keywords, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 6843417e38 068/103: Rename interactive entry point from totp to totp-auth, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 c31034feef 069/103: Fix the totp-auth-hmac.el footer comment, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 5e5f311775 077/103: Fix a checkdoc warning in base32-lsh, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 60dbfaf621 079/103: Use the warning-suppressing lsh wrapper from base32.el, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 49cb6d5468 078/103: Implement the base32hex encoding from RFC4648, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 a41fe7d0f7 072/103: Trivia: fix markup in test file docstring, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 ed4feed432 080/103: Fix a checkdoc warning., ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 c04d223e11 074/103: Fix a docstring xref, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 269044a4a2 082/103: Replace a single use of cl-case with cond, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 95af9632f3 070/103: Wrap lsh in base32.el to suppress misleading lsh vs ash warning,
ELPA Syncer <=
- [nongnu] elpa/base32 11199b1d22 085/103: Our default base32 dictionary is uppercase only, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 49f2e5e7ad 093/103: Add an autoload for the OTP export function, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 5fa6529ace 103/103: Fix another stray docstring reference, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 b048113b66 100/103: Allow user to create secrets interactively, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 19b6939cca 098/103: Prefer the "TOTP" secrets collection over "login" (if it exists), ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 ce7fe1b815 071/103: Tests now indicate where they are loading totp-auth et al from, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 60c0ea49cf 073/103: Suppress more byte compile warnings, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 e28d088223 081/103: Missed a couple of references to totp-auth-lsh, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 ac5b439624 075/103: Document an otpauth-migration URL quirk in a comment, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 7b56905280 084/103: Add technical documentation about the specifications this implements, ELPA Syncer, 2024/02/10