Lines Matching refs:swap
114 * for these "swap" buckets. */
126 /* Storage space for the "swap" buckets.
419 static struct ordered_hashmap_entry *bucket_at_swap(struct swap_entries *swap, unsigned idx) {
420 return &swap->e[idx - _IDX_SWAP_BEGIN];
424 * Understands real indexes and swap indexes, hence "_virtual". */
425 static struct hashmap_base_entry *bucket_at_virtual(HashmapBase *h, struct swap_entries *swap,
431 return &bucket_at_swap(swap, idx)->p.b;
490 static void bucket_move_entry(HashmapBase *h, struct swap_entries *swap,
496 e_from = bucket_at_virtual(h, swap, from);
497 e_to = bucket_at_virtual(h, swap, to);
509 bucket_at_virtual(h, swap, le_to->iterate_next);
515 bucket_at_virtual(h, swap, le_to->iterate_previous);
957 * by the caller into swap slot IDX_PUT.
958 * If used for in-place resizing, may leave a displaced entry in swap slot
964 struct swap_entries *swap) {
978 bucket_move_entry(h, swap, idx, IDX_TMP);
984 bucket_move_entry(h, swap, IDX_PUT, idx);
986 bucket_move_entry(h, swap, IDX_TMP, IDX_PUT);
999 /* swap the entries */
1000 bucket_move_entry(h, swap, idx, IDX_TMP);
1001 bucket_move_entry(h, swap, IDX_PUT, idx);
1002 bucket_move_entry(h, swap, IDX_TMP, IDX_PUT);
1014 * in swap slot IDX_PUT.
1022 struct swap_entries *swap, bool may_resize) {
1028 new_entry = bucket_at_swap(swap, IDX_PUT);
1058 assert_se(hashmap_put_robin_hood(h, idx, swap) == false);
1067 #define hashmap_put_boldly(h, idx, swap, may_resize) \
1068 hashmap_base_put_boldly(HASHMAP_BASE(h), idx, swap, may_resize)
1076 struct swap_entries swap;
1186 bucket_move_entry(h, &swap, idx, IDX_PUT);
1195 rehash_next = hashmap_put_robin_hood(h, optimal_idx, &swap);
1200 optimal_idx = bucket_hash(h, bucket_at_swap(&swap, IDX_PUT)->p.b.key);
1240 struct swap_entries swap;
1255 e = &bucket_at_swap(&swap, IDX_PUT)->p;
1258 return hashmap_put_boldly(h, hash, &swap, true);
1262 struct swap_entries swap;
1273 e = &bucket_at_swap(&swap, IDX_PUT)->p.b;
1275 return hashmap_put_boldly(s, hash, &swap, true);
1279 struct swap_entries swap;
1304 e = &bucket_at_swap(&swap, IDX_PUT)->p;
1307 return hashmap_put_boldly(h, hash, &swap, true);
1421 struct swap_entries swap;
1439 e = &bucket_at_swap(&swap, IDX_PUT)->p;
1442 assert_se(hashmap_put_boldly(h, new_hash, &swap, false) == 1);
1448 struct swap_entries swap;
1466 e = &bucket_at_swap(&swap, IDX_PUT)->p.b;
1468 assert_se(hashmap_put_boldly(s, new_hash, &swap, false) == 1);
1474 struct swap_entries swap;
1501 e = &bucket_at_swap(&swap, IDX_PUT)->p;
1504 assert_se(hashmap_put_boldly(h, new_hash, &swap, false) == 1);
1664 struct swap_entries swap;
1695 n = &bucket_at_swap(&swap, IDX_PUT)->p.b;
1700 assert_se(hashmap_put_boldly(h, h_hash, &swap, false) == 1);
1709 struct swap_entries swap;
1732 n = &bucket_at_swap(&swap, IDX_PUT)->p.b;
1737 r = hashmap_put_boldly(h, h_hash, &swap, true);