partialbyte
Partialbyte is a unit of data representing a portion of a byte, typically between 1 and 7 bits. The concept arises in contexts where data fields are bit-aligned within a byte or byte stream. A partialbyte does not exist as a standalone primitive in most programming languages; instead it is a logical construct that tracks both a bit value and the number of significant bits. Practically, a partialbyte can be stored as a pair (value, length) or as an integer plus a separate length indicator.
Extraction and construction rely on bit masking and shifting. For example, to read the high 3 bits
Applications include network protocols with bit-field fields, compact binary formats, hardware register mapping, and data compression
Because partialbytes are not a standard type, their use varies by language and library. Some languages offer
See also: bit field, nibble, bit packing, bitstream, varint.