  Data compression is a well-studied (and well-solved) problem in the setup of
long coding blocks. But important emerging applications need to compress data
to memory words of small fixed widths. This new setup is the subject of this
paper. In the problem we consider we have two sources with known discrete
distributions, and we wish to find codes that maximize the success probability
that the two source outputs are represented in $L$ bits or less. A good
practical use for this problem is a table with two-field entries that is stored
in a memory of a fixed width $L$. Such tables of very large sizes drive the
core functionalities of network switches and routers. After defining the
problem formally, we solve it optimally with an efficient code-design
algorithm. We also solve the problem in the more constrained case where a
single code is used in both fields (to save space for storing code
dictionaries). For both code-design problems we find decompositions that yield
efficient dynamic-programming algorithms. With an empirical study we show the
success probabilities of the optimal codes for different distributions and
memory widths. In particular, the study demonstrates the superiority of the new
codes over existing compression algorithms.
