| 392 | } |
| 393 | |
| 394 | staticfn int |
| 395 | find_glyph_in_cache(const char *id) |
| 396 | { |
| 397 | uint32 hash = glyph_hash(id); |
| 398 | size_t hash1 = (size_t) (hash & (glyphid_cache_size - 1)); |
| 399 | size_t hash2 = (size_t) |
| 400 | (((hash >> glyphid_cache_lsize) & (glyphid_cache_size - 1)) | 1); |
| 401 | size_t i = hash1; |
| 402 | |
| 403 | do { |
| 404 | if (glyphid_cache[i].id == NULL) { |
| 405 | /* Empty bucket found */ |
| 406 | return -1; |
| 407 | } |
| 408 | if (strcmpi(id, glyphid_cache[i].id) == 0) { |
| 409 | /* Match found */ |
| 410 | return glyphid_cache[i].glyphnum; |
| 411 | } |
| 412 | i = (i + hash2) & (glyphid_cache_size - 1); |
| 413 | } while (i != hash1); |
| 414 | return -1; |
| 415 | } |
| 416 | |
| 417 | staticfn char * |
| 418 | find_glyphid_in_cache_by_glyphnum(int glyphnum) |
no test coverage detected