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). */
| 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). */ |
| 564 | static 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 | |
| 578 | bool cbm_kind_in_set(TSNode node, const char **types) { |
| 579 | if (!types || !types[0]) { |
no test coverage detected