MCPcopy Create free account
hub / github.com/cwida/ALP / ChimpCompressionState

Class ChimpCompressionState

publication/source_code/include/chimp/chimp.hpp:21–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20template <class CHIMP_TYPE, bool EMPTY>
21struct ChimpCompressionState {
22
23 ChimpCompressionState()
24 : previous_leading_zeros(NumericLimits<uint8_t>::Maximum()) {
25 previous_value = 0;
26 }
27
28 inline void SetLeadingZeros(int32_t value = NumericLimits<uint8_t>::Maximum()) {
29 this->previous_leading_zeros = value;
30 }
31
32 void Flush() { leading_zero_buffer.Flush(); }
33
34 // Reset the state
35 void Reset() {
36 first = true;
37 SetLeadingZeros();
38 leading_zero_buffer.Reset();
39 flag_buffer.Reset();
40 previous_value = 0;
41 }
42
43 CHIMP_TYPE BitsWritten() const {
44 return output.BitsWritten() + leading_zero_buffer.BitsWritten() + flag_buffer.BitsWritten();
45 }
46
47 OutputBitStream<EMPTY> output; // The stream to write to
48 LeadingZeroBuffer<EMPTY> leading_zero_buffer;
49 FlagBuffer<EMPTY> flag_buffer;
50 uint8_t previous_leading_zeros; //! The leading zeros of the reference value
51 CHIMP_TYPE previous_value = 0;
52 bool first = true;
53};
54
55template <class CHIMP_TYPE, bool EMPTY>
56class ChimpCompression {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected