Skip to content
Snippets Groups Projects
Commit 86ef236c authored by Junio C Hamano's avatar Junio C Hamano
Browse files

Merge branch 'jk/hashcmp-optim-for-2.19'

Partially revert the support for multiple hash functions to regain
hash comparison performance; we'd think of a way to do this better
in the next cycle.

* jk/hashcmp-optim-for-2.19:
  hashcmp: assert constant hash size
parents 99fb11d1 183a638b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1023,6 +1023,16 @@ extern const struct object_id null_oid;
 
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
{
/*
* This is a temporary optimization hack. By asserting the size here,
* we let the compiler know that it's always going to be 20, which lets
* it turn this fixed-size memcmp into a few inline instructions.
*
* This will need to be extended or ripped out when we learn about
* hashes of different sizes.
*/
if (the_hash_algo->rawsz != 20)
BUG("hash size not yet supported by hashcmp");
return memcmp(sha1, sha2, the_hash_algo->rawsz);
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment