5#ifndef BITCOIN_UTIL_GOLOMBRICE_H
6#define BITCOIN_UTIL_GOLOMBRICE_H
12template <
typename OStream>
18 int nbits = q <= 64 ? static_cast<int>(q) : 64;
19 bitwriter.
Write(~0ULL, nbits);
22 bitwriter.
Write(0, 1);
26 bitwriter.
Write(x, P);
29template <
typename IStream>
34 while (bitreader.
Read(1) == 1) {
38 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.
static uint64_t GolombRiceDecode(BitStreamReader< IStream > &bitreader, uint8_t P)
static void GolombRiceEncode(BitStreamWriter< OStream > &bitwriter, uint8_t P, uint64_t x)