MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ks_get

Function ks_get

internal/cbm/helpers.c:564–576  ·  view source on GitHub ↗

Find or build the cache slot for (lang, types). Returns NULL only if the * thread-local table is saturated at this hash (extremely rare → strcmp). */

Source from the content-addressed store, hash-verified

562/* Find or build the cache slot for (lang, types). Returns NULL only if the
563 * thread-local table is saturated at this hash (extremely rare → strcmp). */
564static ks_slot_t *ks_get(const TSLanguage *lang, const char *const *types) {
565 uintptr_t h = ((uintptr_t)types >> 4) ^ ((uintptr_t)lang >> 3) ^ ((uintptr_t)types >> 13);
566 for (int probe = 0; probe < KS_PROBE; probe++) {
567 ks_slot_t *s = &ks_cache[(size_t)(h + (uintptr_t)probe) & KS_SLOT_MASK];
568 if (s->lang == NULL) {
569 return ks_build(lang, types, s);
570 }
571 if (s->lang == lang && s->types == types) {
572 return s;
573 }
574 }
575 return NULL;
576}
577
578bool cbm_kind_in_set(TSNode node, const char **types) {
579 if (!types || !types[0]) {

Callers 1

cbm_kind_in_setFunction · 0.85

Calls 1

ks_buildFunction · 0.85

Tested by

no test coverage detected