MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / read_bits

Function read_bits

Source/astcenc_symbolic_physical.cpp:54–66  ·  view source on GitHub ↗

* @brief Read up to 8 bits at an arbitrary bit offset. * * The stored value is at most 8 bits, but can be stored at an offset of between 0 and 7 bits so may * span two separate bytes in memory. * * @param bitcount The number of bits to read. * @param bitoffset The bit offset to read from, between 0 and 7. * @param[in,out] ptr The data pointer to read from. * *

Source from the content-addressed store, hash-verified

52 * @return The read value.
53 */
54static inline int read_bits(
55 int bitcount,
56 int bitoffset,
57 const uint8_t* ptr
58) {
59 int mask = (1 << bitcount) - 1;
60 ptr += bitoffset >> 3;
61 bitoffset &= 7;
62 int value = ptr[0] | (ptr[1] << 8);
63 value >>= bitoffset;
64 value &= mask;
65 return value;
66}
67
68#if !defined(ASTCENC_DECOMPRESS_ONLY)
69

Callers 1

physical_to_symbolicFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected