Created
June 15, 2009 23:04
-
-
Save methodmissing/130413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef unsigned long rb_value_t; | |
| typedef unsigned long rb_id_t; | |
| typedef unsigned long st_data_t; | |
| struct st_table_entry { | |
| unsigned int hash; | |
| st_data_t key; | |
| st_data_t record; | |
| caddr_t next; | |
| }; | |
| translator struct st_table_entry < struct st_table_entry *STE > { | |
| hash = STE->hash; | |
| key = STE->key; | |
| record = STE->record; | |
| next = (caddr_t)STE->next; | |
| }; | |
| struct st_hash_type { | |
| int (*compare)(); | |
| int (*hash)(); | |
| }; | |
| translator struct st_hash_type < struct st_hash_type *HT > { | |
| compare = HT->compare; | |
| hash = HT->hash; | |
| }; | |
| struct st_table { | |
| struct st_hash_type *type; | |
| int num_bins; | |
| int num_entries; | |
| struct st_table_entry **bins; | |
| }; | |
| translator struct st_table < struct st_table *ST > { | |
| type = (struct st_hash_type *)ST->type; | |
| num_bins = ST->num_bins; | |
| num_entries = ST->num_entries; | |
| bins = (struct st_table_entry **)ST->bins; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment