diff options
Diffstat (limited to 'hashmap.h')
-rw-r--r-- | hashmap.h | 23 |
1 files changed, 1 insertions, 22 deletions
@@ -1,8 +1,6 @@ #ifndef HASHMAP_H #define HASHMAP_H -#include "hash.h" - /* * Generic implementation of hash-based key-value mappings. * @@ -121,25 +119,6 @@ unsigned int memihash(const void *buf, size_t len); unsigned int memihash_cont(unsigned int hash_seed, const void *buf, size_t len); /* - * Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code - * for use in hash tables. Cryptographic hashes are supposed to have - * uniform distribution, so in contrast to `memhash()`, this just copies - * the first `sizeof(int)` bytes without shuffling any bits. Note that - * the results will be different on big-endian and little-endian - * platforms, so they should not be stored or transferred over the net. - */ -static inline unsigned int oidhash(const struct object_id *oid) -{ - /* - * Equivalent to 'return *(unsigned int *)oid->hash;', but safe on - * platforms that don't support unaligned reads. - */ - unsigned int hash; - memcpy(&hash, oid->hash, sizeof(hash)); - return hash; -} - -/* * struct hashmap_entry is an opaque structure representing an entry in the * hash table. * Ideally it should be followed by an int-sized member to prevent unused @@ -270,7 +249,7 @@ void hashmap_clear_(struct hashmap *map, ssize_t offset); #define hashmap_clear(map) hashmap_clear_(map, -1) /* - * Similar to hashmap_clear(), except that the table is no deallocated; it + * Similar to hashmap_clear(), except that the table is not deallocated; it * is merely zeroed out but left the same size as before. If the hashmap * will be reused, this avoids the overhead of deallocating and * reallocating map->table. As with hashmap_clear(), you may need to free |