Reference Guide C API www.spreadconcepts.com


C API
Replicated Hash Table
Version 2.0


rht_key_hcode_fcn
  long rht_key_hcode_fcn(rht_blob k, const void *kcntxt);


Parameters
  k key to compute hashcode on
  kcntxt user context


Return Values
  hashcode of given key


Description
 

User defined function to generate a hash code for a given key.

Additionally, for ordered dictionaries (coming soon):

  • Your key_hcode mapping must be an invariant mapping from keys to the integer range [-2^31, 2^31). Any predictable structure in the mapping will be removed by the dictionary (i.e. - it is OK if your mapping exhibits strong structure; for example such as mapping all keys of a certain type only to even integers).
  • For best performance, a random key should have approximately 1 / 2^32 probability of mapping to any given value.
  • Your key_cmp relation and key_hcode mapping must be equality compatible: [key_cmp(key1, key2) == 0 => key_hcode(key1) == key_hcode(key2)]. Note that the reverse implication need not be true.


Requirements
  Header: Declared in rht.h
Library: Use rht.lib
Version: 2.0


Also See
  RHT reference guide, key_cmp_fnc, callback functions


Copyright © 2004, Spread Concepts LLC, All rights reserved