Method and apparatus for reducing memory usage by encoding two values in a single field

One embodiment of the present invention provides a system that reduces memory usage by encoding two values in a single field. During operation, the system receives a string. After determining the length of the string, the system allocates a first set of bits in the single field to store the length o...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: LUND KASPER VERDICH, AGER MADS SIG, BAK LARS
Format: Patent
Sprache:eng
Schlagworte:
Online-Zugang:Volltext bestellen
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:One embodiment of the present invention provides a system that reduces memory usage by encoding two values in a single field. During operation, the system receives a string. After determining the length of the string, the system allocates a first set of bits in the single field to store the length of the string, where the size of this first set of bits depends upon the determined length of the string. The system then stores the length of the string in the first set of bits. Subsequently, the system computes a hash code for the string. The system then allocates a second set of bits from the remaining unallocated bits in the single field to store this hash code, and stores the hash code in this second set of bits. Thereafter, the system can access the string length value from the single field and can also use the entire single field as a hash value for the string.