gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lsd0003] branch master updated: Fixed some code formating


From: gnunet
Subject: [lsd0003] branch master updated: Fixed some code formating
Date: Tue, 15 Jun 2021 10:28:57 +0200

This is an automated email from the git hooks/post-receive script.

elias-summermatter pushed a commit to branch master
in repository lsd0003.

The following commit(s) were added to refs/heads/master by this push:
     new 6b5f616  Fixed some code formating
6b5f616 is described below

commit 6b5f616647574ad7b8a98125490b0aea61170088
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Tue Jun 15 10:26:02 2021 +0200

    Fixed some code formating
---
 draft-summermatter-set-union.xml | 58 +++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 33 deletions(-)

diff --git a/draft-summermatter-set-union.xml b/draft-summermatter-set-union.xml
index 1a82d3d..a344788 100644
--- a/draft-summermatter-set-union.xml
+++ b/draft-summermatter-set-union.xml
@@ -2259,35 +2259,24 @@ FUNCTION pack_counter(ibf, offset, count)
         counter = bucket.counter
         byte_len = counter_bytes
 
-        WHILE TRUE
-            byte_to_write = 0
+        WHILE byte_len + store_bits < 8
+            bit_to_shift = 0
 
-            IF byte_len + store_bits >= 8
-                bit_to_shift = 0
-
-                IF store_bits > 0 OR byte_len > 8
-                    bit_free = 8 - store_bits
-                    bit_to_shift = byte_len - bit_free
-                    store = store << bit_free
-                END IF
-                byte_to_write = (( counter >> bit_to_shift) | store) & 0xFF
-                byte_len -= 8 - store_bits
-                counter = counter & ((1 << byte_len) - 1)
-                store = 0
-                store_bits = 0
-            ELSE
-                IF 0 == store_bits
-                    store = counter
-                ELSE
-                    store = (store << byte_len) | counter
-                END IF
-                store_bits = store_bits + byte_len
-                byte_len = 0
-                BREAK
+            IF store_bits > 0 OR byte_len > 8
+                bit_free = 8 - store_bits
+                bit_to_shift = byte_len - bit_free
+                store = store << bit_free
             END IF
-            buffer[byte_ctr] = byte_to_write
+            buffer[byte_ctr] = (( counter >> bit_to_shift) | store) & 0xFF
             byte_ctr = byte_ctr + 1
+            byte_len -= 8 - store_bits
+            counter = counter & ((1 << byte_len) - 1)
+            store = 0
+            store_bits = 0
         END WHILE
+        store = (store << byte_len) | counter
+        store_bits = store_bits + byte_len
+        byte_len = 0
     END FOR
 
     # Write the last partial packed byte to the buffer
@@ -2353,10 +2342,12 @@ FUNCTION unpack_counter(ibf, offset, count, cbl, pd)
                 ELSE
                     store = store << bit_to_pack_left
                     store = store | byte_to_read
+                END IF
                 BREAK
             END IF
         END WHILE
     END WHILE
+END FUNCTION
                                     ]]></artwork>
                 </figure>
             </section>
@@ -2398,8 +2389,9 @@ FUNCTION unpack_counter(ibf, offset, count, cbl, pd)
 # Returns: Salted value
 
 FUNCTION se_key_salting(value, salt)
-    s = (salt * 7) % 64
+    s = (salt * 7) modulo 64
     return (value >> s) | (value << (64 - s))
+END FUNCTION
 
                                     ]]></artwork>
                 </figure>
@@ -2478,7 +2470,7 @@ FUNCTION check_byzantine_bounds (rec,rsd,lec,lsd)
     IF (rec < LOWER_BOUND)
         RETURN FALSE
     IF END
-        RETURN TRUE
+    RETURN TRUE
 FUNCTION END
                     ]]></artwork>
                 </figure>
@@ -2582,13 +2574,13 @@ FUNCTION END
 # Returns TRUE if the message flow was followed, otherwise FALSE
 FUNCTION send(store, mt, hash)
 
-    IF NOT store.contains(hash)
+    IF NOT hash IS IN store
         store_element = initialize_element()
     ELSE
         store_element = store.get(hash)
     END IF
 
-    CASE based on mt
+    CASE based ON mt
         CASE INQUIRY
             IF store_element.INQUIRY == NOT_INITIALIZED
                 store_element.INQUIRY = SENT
@@ -2620,8 +2612,8 @@ FUNCTION send(store, mt, hash)
             END IF
         DEFAULT
             RETURN FALSE
-        CASE END
-   store.put(hash,store_element)
+    CASE END
+   ADD OR UPDATE KEY hash IN store WITH store_element
    RETURN TRUE
 FUNCTION END
 
@@ -2633,7 +2625,7 @@ FUNCTION END
 # Output:
 # Returns TRUE if the message flow was followed, otherwise FALSE
 FUNCTION receive (store, mt, hash)
-    IF NOT store.contains(hash)
+     IF NOT hash IS IN store
         store_element = initialize_element()
     ELSE
         store_element = store.get(hash)
@@ -2669,7 +2661,7 @@ FUNCTION receive (store, mt, hash)
         DEFAULT
             RETURN FALSE
         CASE END
-   store.put(hash,store_element)
+   ADD OR UPDATE KEY hash IN store WITH store_element
    RETURN TRUE
 FUNCTION END
 

-- 
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]