One Comment

  1. An example of a piece of code using libghthash:

        ght_hash_table_t *tx_table = NULL;
        ppm_tx_id_t txid;
    
        // prepare the hash table
        tx_table = ght_create(HASH_TABLE_SIZE);
    
        // allow rehash. Note: rehashing is costly.
        ght_set_rehash(tx_table, TRUE);
    
    
        ...
    
    
        // check the hash whether the txid key exists
        pdata = ght_get(tx_table,
                sizeof(ppm_tx_id_t), &(txid));
    
        if (pdata != NULL) {
            // replace the entry in the hash table
            ght_replace(tx_table,
                    &type_b,
                    sizeof(ppm_tx_id_t), &(txid));
        } else {
            // insert to the hash
            ght_insert(tx_table,
                    &type_b,
                    sizeof(ppm_tx_id_t), &(txid));
        }
    

Leave a Reply

Your email address will not be published. Required fields are marked *