US 7,592,930 B1
Method and apparatus for reducing memory usage by encoding two values in a single field
Mads Sig Ager, Laasby (Denmark); Lars Bak, Tranbjerg J. (Denmark); and Kasper Verdich Lund, Hoejbjerg (Denmark)
Assigned to Google Inc., Mountain View, Calif. (US)
Filed on May 13, 2008, as Appl. No. 12/120,085.
Int. Cl. H03M 7/00 (2006.01)
U.S. Cl. 341—50  [709/219; 707/103 R; 717/108] 20 Claims
OG exemplary drawing
 
1. A method for reducing memory usage by encoding two values in a single field, comprising:
receiving a string;
determining a length of the string;
allocating a first set of bits in the single field for storing the length of the string, wherein a size of the first set of bits depends upon the length of the string;
storing the length of the string in the first set of bits;
computing a hash code for the string;
allocating a second set of bits in the single field for storing the hash code, wherein the second set of bits is allocated from bits which remain in the single field after the first set of bits has been allocated; and
storing the hash code in the second set of bits.