commit 01f783fdf0bc3a93b3f65cab90356ee04600e5c5
parent 7206b03239f8335b407878e8468f2b1f4474927f
Author: Elias Summermatter <elias.summermatter@seccom.ch>
Date: Mon, 14 Jun 2021 15:50:38 +0200
Fixed some bugs in unpack
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/draft-summermatter-set-union.xml b/draft-summermatter-set-union.xml
@@ -2311,17 +2311,15 @@ FUNCTION END
# returns: Nothing because the unpacked counter is saved directly into the IBF
FUNCTION unpack_counter(ibf, offset, count, cbl, pd)
+ ibf_bucket_ctr = 0
store = 0
store_bits = 0
byte_ctr = 0
- ibf_bucket_ctr = 0
-
- number_bytes_read = CEILING((count * cbl) / 8)
- WHILE ibf_bucket_ctr <= (count -1)
+ WHILE TRUE
byte_to_read = pd[byte_ctr]
- byte_ctr++
bit_to_pack_left = 8
+ byte_ctr++
WHILE bit_to_pack_left >= 0
@@ -2339,7 +2337,7 @@ FUNCTION unpack_counter(ibf, offset, count, cbl, pd)
bytes_to_shift = bit_to_pack_left - bit_use
counter_partial = byte_to_read >> bytes_to_shift
store = store | counter_partial
- ibf.counter[ibf_bucket_ctr] = store
+ ibf.counter[ibf_bucket_ctr + offset] = store
byte_to_read = byte_to_read & (( 1 << bytes_to_shift ) - 1)
bit_to_pack_left -= bit_use