Skip to content

Commit

Permalink
Fix pseudocode on bip-0158
Browse files Browse the repository at this point in the history
The golomb_encode function should encde r instead of x.
  • Loading branch information
AlexITC committed Mar 12, 2019
1 parent b485340 commit 5222836
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bip-0158.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@ this is a table of Golomb-Rice coded values using <code>P=2</code>:
<pre>
golomb_encode(stream, x: uint64, P: uint):
let q = x >> P
let r = (x & ((1 << p)-1))

while q > 0:
write_bit(stream, 1)
q--
write_bit(stream, 0)
write_bits_big_endian(stream, x, P)
write_bits_big_endian(stream, r, P)
golomb_decode(stream, P: uint) -> uint64:
let q = 0
Expand Down

0 comments on commit 5222836

Please sign in to comment.