summaryrefslogtreecommitdiff
path: root/src/htsinthash.h
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2013-06-24 16:46:52 +0000
committerXavier Roche <xroche@users.noreply.github.com>2013-06-24 16:46:52 +0000
commit9e61bc36f3a3d15375b11321893dd27cd7d4b88b (patch)
tree47541e5212ee7bb4004d2d9d824742cf8ab2741e /src/htsinthash.h
parenta01be59015d2f7f8db5b97997daa57b636141f5d (diff)
Keep hashes in hashtable items so that we do jot have to recompute them in case of rehash
Attempt to push back items from the stash when deleting an entry Added some logging
Diffstat (limited to 'src/htsinthash.h')
-rw-r--r--src/htsinthash.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/htsinthash.h b/src/htsinthash.h
index 610ee34..1178e46 100644
--- a/src/htsinthash.h
+++ b/src/htsinthash.h
@@ -70,6 +70,7 @@ Please visit our Website: http://www.httrack.com
typedef union inthash_value {
/** Integer value. **/
uintptr_t intg;
+
/** Pointer value. **/
void *ptr;
} inthash_value;
@@ -82,12 +83,28 @@ typedef union inthash_value {
typedef struct inthash_item inthash_item;
#endif
+/* Hash key (32-bit) */
+typedef unsigned int inthash_key;
+
+/* Pair of hashes */
+typedef struct inthash_keys {
+ inthash_key hash1;
+ inthash_key hash2;
+} inthash_keys;
+
+/** NULL pair of hashes. **/
+#define INTHASH_KEYS_NULL { 0, 0 }
+
/** Item holding a value. **/
struct inthash_item {
/** Key. **/
char *name;
+
/** Value. **/
inthash_value value;
+
+ /** Hashes of the key. **/
+ inthash_keys hashes;
};
/* Alias for legacy code */
@@ -146,6 +163,7 @@ void inthash_add_pvoid(inthash hashtable, const char *name, void *value);
void inthash_add(inthash hashtable, const char *name, intptr_t value); /* Add entry in the hash table */
int inthash_write(inthash hashtable, const char *name, intptr_t value); /* Overwrite/add entry in the hash table */
int inthash_inc(inthash hashtable, const char *name); /* Increment entry in the hash table */
+int inthash_dec(inthash hashtable, const char *name); /* Decrement entry in the hash table */
int inthash_remove(inthash hashtable, const char *name); /* Remove an entry from the hashtable */
/* */