1 #include <integeritem.h>
4 * This callback function returns the hashcode of a key. The hashcode
5 * is used for indexing into the backing Vector for finding the an
6 * item via its key. The same key must map consistently to the same
7 * hashcode while the hashtable contains an item with that key.
8 * Different keys map map to the same hashcode, in which case the
9 * Vector placement is made at the first empty or hole slot following
12 static unsigned long integeritem_hashcode(void *this,void *key) {
13 return (unsigned long) key;
17 * This callback function determines whether an item has a
20 static int integeritem_haskey(void *this,void *item,void *key) {
25 * This callback function returns the key of an item by considering
26 * the arity and schema.
28 static void *integeritem_itemkey(void *this,void *item) {
33 * This callback function handles a key obtained from the itemkey
34 * callback function to reclaim temporary allocation.
36 static void integeritem_releasekey(void *this,void *key) {
40 * This callback function writes a representation of an item into
43 static int integeritem_tostring(void *this,void *item,char *buffer,int limit) {
44 return snprintf( buffer, limit, "%lld", (long long) item );
47 ItemKeyFun integeritem = {
48 .hashcode = integeritem_hashcode,
49 .haskey = integeritem_haskey,
50 .itemkey = integeritem_itemkey,
51 .releasekey = integeritem_releasekey,
52 .tostring = integeritem_tostring