MCPcopy Create free account
hub / github.com/git/git / cb_internal_best_match

Function cb_internal_best_match

cbtree.c:21–32  ·  view source on GitHub ↗

locate the best match, does not do a final comparison */

Source from the content-addressed store, hash-verified

19
20/* locate the best match, does not do a final comparison */
21static struct cb_node *cb_internal_best_match(struct cb_node *p,
22 const uint8_t *k, size_t klen)
23{
24 while (1 & (uintptr_t)p) {
25 struct cb_node *q = cb_node_of(p);
26 uint8_t c = q->byte < klen ? k[q->byte] : 0;
27 size_t direction = (1 + (q->otherbits | c)) >> 8;
28
29 p = q->child[direction];
30 }
31 return p;
32}
33
34/* returns NULL if successful, existing cb_node if duplicate */
35struct cb_node *cb_insert(struct cb_tree *t, struct cb_node *node, size_t klen)

Callers 2

cb_insertFunction · 0.85
cb_lookupFunction · 0.85

Calls 1

cb_node_ofFunction · 0.85

Tested by

no test coverage detected