5#ifndef BITCOIN_UTIL_GOLOMBRICE_H
6#define BITCOIN_UTIL_GOLOMBRICE_H
14template <
typename OStream>
20 int nbits = q <= 64 ? static_cast<int>(q) : 64;
21 bitwriter.
Write(~0ULL, nbits);
24 bitwriter.
Write(0, 1);
28 bitwriter.
Write(x, P);
31template <
typename IStream>
36 while (bitreader.
Read(1) == 1) {
40 uint64_t r = bitreader.
Read(P);
uint64_t Read(int nbits)
Read the specified number of bits from the stream.
void Write(uint64_t data, int nbits)
Write the nbits least significant bits of a 64-bit int to the output stream.
uint64_t GolombRiceDecode(BitStreamReader< IStream > &bitreader, uint8_t P)
void GolombRiceEncode(BitStreamWriter< OStream > &bitwriter, uint8_t P, uint64_t x)