[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lsd0003] branch master updated: Fixed packing algo
From: |
gnunet |
Subject: |
[lsd0003] branch master updated: Fixed packing algo |
Date: |
Mon, 14 Jun 2021 15:37:50 +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 7206b03 Fixed packing algo
7206b03 is described below
commit 7206b03239f8335b407878e8468f2b1f4474927f
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Mon Jun 14 15:34:59 2021 +0200
Fixed packing algo
---
draft-summermatter-set-union.xml | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/draft-summermatter-set-union.xml b/draft-summermatter-set-union.xml
index 4531e19..a728fc9 100644
--- a/draft-summermatter-set-union.xml
+++ b/draft-summermatter-set-union.xml
@@ -2240,38 +2240,46 @@ FUNCTION ibf_get_max_counter(ibf)
# OUTPUTS:
# returns: A byte array of packed counters to send over the network
+# INPUTS:
+# ibf: The IBF
+# offset: The offset which defines the starting point from which bucket the
+# pack operation starts
+# count: The number of buckets in the array that will be packed
+# OUTPUTS:
+# returns: A byte array of packed counters to send over the network
+
FUNCTION pack_counter(ibf, offset, count)
counter_bytes = ibf_get_max_counter(ibf)
- store = 0
store_bits = 0
+ store = 0
byte_ctr = 0
buffer=[]
FOR bucket IN ibf[offset] to ibf[count]
- byte_len = counter_bytes
counter = bucket.counter
+ byte_len = counter_bytes
- WHILE byte_len > 0
+ WHILE TRUE
byte_to_write = 0
- IF counter_bytes + store_bits >= 8
+ IF byte_len + store_bits >= 8
bit_to_shift = 0
- IF store_bits > 0 OR counter_bytes > 8
+ IF store_bits > 0 OR byte_len > 8
bit_free = 8 - store_bits
- bit_to_shift = counter_bytes - bit_free
+ bit_to_shift = byte_len - bit_free
store = store << bit_free
END IF
byte_to_write = (( counter >> bit_to_shift) | store) & 0xFF
- bit_to_shift -= 8 - store_bits
- counter = counter & ((1 << counter_bytes) - 1)
+ 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 << counter_bytes) | counter
+ store = (store << byte_len) | counter
END IF
store_bits = store_bits + byte_len
byte_len = 0
@@ -2288,6 +2296,7 @@ FUNCTION pack_counter(ibf, offset, count)
byte_ctr = byte_ctr + 1
RETURN buffer
+FUNCTION END
# INPUTS:
# ibf: The IBF
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lsd0003] branch master updated: Fixed packing algo,
gnunet <=