| 202 | } |
| 203 | |
| 204 | static bool |
| 205 | ckh_try_insert(ckh_t *ckh, void const**argkey, void const**argdata) { |
| 206 | size_t hashes[2], bucket; |
| 207 | const void *key = *argkey; |
| 208 | const void *data = *argdata; |
| 209 | |
| 210 | ckh->hash(key, hashes); |
| 211 | |
| 212 | /* Try to insert in primary bucket. */ |
| 213 | bucket = hashes[0] & ((ZU(1) << ckh->lg_curbuckets) - 1); |
| 214 | if (!ckh_try_bucket_insert(ckh, bucket, key, data)) { |
| 215 | return false; |
| 216 | } |
| 217 | |
| 218 | /* Try to insert in secondary bucket. */ |
| 219 | bucket = hashes[1] & ((ZU(1) << ckh->lg_curbuckets) - 1); |
| 220 | if (!ckh_try_bucket_insert(ckh, bucket, key, data)) { |
| 221 | return false; |
| 222 | } |
| 223 | |
| 224 | /* |
| 225 | * Try to find a place for this item via iterative eviction/relocation. |
| 226 | */ |
| 227 | return ckh_evict_reloc_insert(ckh, bucket, argkey, argdata); |
| 228 | } |
| 229 | |
| 230 | /* |
| 231 | * Try to rebuild the hash table from scratch by inserting all items from the |
no test coverage detected