gnunet-svn
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]