MCPcopy Index your code
hub / github.com/git/git / oidhash

Function oidhash

hash.h:444–453  ·  view source on GitHub ↗

* 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 tra

Source from the content-addressed store, hash-verified

442 * platforms, so they should not be stored or transferred over the net.
443 */
444static inline unsigned int oidhash(const struct object_id *oid)
445{
446 /*
447 * Equivalent to 'return *(unsigned int *)oid->hash;', but safe on
448 * platforms that don't support unaligned reads.
449 */
450 unsigned int hash;
451 memcpy(&hash, oid->hash, sizeof(hash));
452 return hash;
453}
454
455static inline int is_null_oid(const struct object_id *oid)
456{

Callers 14

hash_filespecFunction · 0.85
oidhash_by_valueFunction · 0.85
hash_objFunction · 0.85
hash_objFunction · 0.85
init_patch_id_entryFunction · 0.85
locate_object_entry_hashFunction · 0.85
oidmap_getFunction · 0.85
oidmap_removeFunction · 0.85
oidmap_putFunction · 0.85
find_commit_nameFunction · 0.85
add_to_known_namesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected