====== Packing ====== 'Packing' refers to the practice of representing information using only the minimum number of bits required, and arranging those bits contiguously in memory or in a data stream. In other words, it avoids wasting unused bits when encoding values. In data representation and programming, packing is often used to combine multiple values into a compact layout. This may involve packing fields into tuples or aggregate types, especially when memory usage, cache efficiency, storage size, or binary serialisation performance matters. ===== Minimum required bits ===== Encoding information as binary digits, or bits, requires an encoding scheme that defines how values are mapped to bit patterns and how those bit patterns are decoded back into values. For a finite set of possible values, the minimum fixed-width binary representation requires enough bits to uniquely encode every value. This bit width is determined by the cardinality of the value set. ceil(log2(number of possible values))