[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 06/08: data-string: Simplify string->data more.
From: |
gnunet |
Subject: |
[gnunet-scheme] 06/08: data-string: Simplify string->data more. |
Date: |
Mon, 29 Aug 2022 00:15:11 +0200 |
This is an automated email from the git hooks/post-receive script.
maxime-devos pushed a commit to branch master
in repository gnunet-scheme.
commit 9630d22c02bca847f223698d61d74a1e3adefeec
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Mon Aug 29 00:10:01 2022 +0200
data-string: Simplify string->data more.
---
gnu/gnunet/data-string.scm | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/gnu/gnunet/data-string.scm b/gnu/gnunet/data-string.scm
index 6b59519..0823299 100644
--- a/gnu/gnunet/data-string.scm
+++ b/gnu/gnunet/data-string.scm
@@ -124,20 +124,17 @@ Return the data as a bytevector on success, or raise a
(if (= 0 out-size)
#vu8()
(raise-bogus-crockford-base32hex)))
- (<-- (vbit shift rpos bits)
- (if (< 0 (mod encoded-len 5))
- ;; padding!
- (let* ((vbit (mod encoded-len 5))
- (shift (- 5 vbit))
- (rpos (- rpos 1))
- (ret (get-value (string-ref enc rpos)))
- (bits (bitwise-arithmetic-shift-right ret shift)))
- (values vbit shift rpos bits))
- (let* ((vbit 5)
- (shift 0)
- (rpos (- rpos 1))
- (bits (get-value (string-ref enc rpos))))
- (values vbit shift rpos bits))))
+ ;; TODO: teach the compiler and optimiser about ceiling-remainder
+ (! vbit
+ (if (< 0 (mod encoded-len 5))
+ ;; padding!
+ (mod encoded-len 5)
+ 5))
+ (! shift (- 5 vbit))
+ (! rpos (- rpos 1))
+ (! bits (bitwise-arithmetic-shift-right
+ (get-value (string-ref enc rpos))
+ shift))
(? (not (= (/ (+ encoded-len shift) 5)
(string-length enc)))
(raise-bogus-crockford-base32hex))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet-scheme] branch master updated (1b75c50 -> a9dbb6e), gnunet, 2022/08/28
- [gnunet-scheme] 04/08: data-string: Remove some dead code in string->data., gnunet, 2022/08/28
- [gnunet-scheme] 02/08: data-string: Raise exceptions in case of bogus input., gnunet, 2022/08/28
- [gnunet-scheme] 01/08: Makefile.am: Register (gnu gnunet data-string)., gnunet, 2022/08/28
- [gnunet-scheme] 03/08: data-string: Make string->data do less mutation., gnunet, 2022/08/28
- [gnunet-scheme] 08/08: data-string: Do not select imports., gnunet, 2022/08/28
- [gnunet-scheme] 07/08: hat-let: Allow both _., gnunet, 2022/08/28
- [gnunet-scheme] 05/08: data-string: Small simplification., gnunet, 2022/08/28
- [gnunet-scheme] 06/08: data-string: Simplify string->data more.,
gnunet <=