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

Method Unpack

publication/source_code/include/chimp/packed_data.hpp:39–45  ·  view source on GitHub ↗

|----------------| //! packed_data(16) bits IIIIIII //! Index (7 bits, shifted by 9) LLL //! LeadingZeros (3 bits, shifted by 6) SSSSSS //! SignificantBits (6 bits)

Source from the content-addressed store, hash-verified

37 // LLL //! LeadingZeros (3 bits, shifted by 6)
38 // SSSSSS //! SignificantBits (6 bits)
39 static inline void Unpack(uint16_t packed_data, UnpackedData& dest) {
40 dest.index = packed_data >> INDEX_SHIFT_AMOUNT & INDEX_MASK;
41 dest.leading_zero = packed_data >> LEADING_SHIFT_AMOUNT & LEADING_MASK;
42 dest.significant_bits = packed_data & SignificantBits<CHIMP_TYPE>::mask;
43 // Verify that combined, this is not bigger than the full size of the type
44 D_ASSERT(dest.significant_bits + dest.leading_zero <= (sizeof(CHIMP_TYPE) * 8));
45 }
46
47 static inline uint16_t Pack(uint8_t index, uint8_t leading_zero, uint8_t significant_bits) {
48 static constexpr uint8_t BIT_SIZE = (sizeof(CHIMP_TYPE) * 8);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected