Skip to content

Commit 16ca608

Browse files
committed
Updated AddToVisited to use HnswElementPtr
1 parent 8dde14a commit 16ca608

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/hnswutils.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,11 @@ InitVisited(char *base, visited_hash * v, Relation index, int ef, int m)
669669
* Add to visited
670670
*/
671671
static inline void
672-
AddToVisited(char *base, visited_hash * v, HnswCandidate * hc, Relation index, bool *found)
672+
AddToVisited(char *base, visited_hash * v, HnswElementPtr elementPtr, Relation index, bool *found)
673673
{
674674
if (index != NULL)
675675
{
676-
HnswElement element = HnswPtrAccess(base, hc->element);
676+
HnswElement element = HnswPtrAccess(base, elementPtr);
677677
ItemPointerData indextid;
678678

679679
ItemPointerSet(&indextid, element->blkno, element->offno);
@@ -682,21 +682,21 @@ AddToVisited(char *base, visited_hash * v, HnswCandidate * hc, Relation index, b
682682
else if (base != NULL)
683683
{
684684
#if PG_VERSION_NUM >= 130000
685-
HnswElement element = HnswPtrAccess(base, hc->element);
685+
HnswElement element = HnswPtrAccess(base, elementPtr);
686686

687-
offsethash_insert_hash(v->offsets, HnswPtrOffset(hc->element), element->hash, found);
687+
offsethash_insert_hash(v->offsets, HnswPtrOffset(elementPtr), element->hash, found);
688688
#else
689-
offsethash_insert(v->offsets, HnswPtrOffset(hc->element), found);
689+
offsethash_insert(v->offsets, HnswPtrOffset(elementPtr), found);
690690
#endif
691691
}
692692
else
693693
{
694694
#if PG_VERSION_NUM >= 130000
695-
HnswElement element = HnswPtrAccess(base, hc->element);
695+
HnswElement element = HnswPtrAccess(base, elementPtr);
696696

697-
pointerhash_insert_hash(v->pointers, (uintptr_t) HnswPtrPointer(hc->element), element->hash, found);
697+
pointerhash_insert_hash(v->pointers, (uintptr_t) HnswPtrPointer(elementPtr), element->hash, found);
698698
#else
699-
pointerhash_insert(v->pointers, (uintptr_t) HnswPtrPointer(hc->element), found);
699+
pointerhash_insert(v->pointers, (uintptr_t) HnswPtrPointer(elementPtr), found);
700700
#endif
701701
}
702702
}
@@ -738,7 +738,7 @@ HnswLoadUnvisitedFromMemory(char *base, HnswElement element, HnswElement * unvis
738738
HnswCandidate *hc = &neighborhood->items[i];
739739
bool found;
740740

741-
AddToVisited(base, v, hc, NULL, &found);
741+
AddToVisited(base, v, hc->element, NULL, &found);
742742

743743
if (!found)
744744
unvisited[(*unvisitedLength)++] = HnswPtrAccess(base, hc->element);
@@ -820,7 +820,7 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F
820820
bool found;
821821
HnswPairingHeapNode *node;
822822

823-
AddToVisited(base, &v, hc, index, &found);
823+
AddToVisited(base, &v, hc->element, index, &found);
824824

825825
node = CreatePairingHeapNode(hc);
826826
pairingheap_add(C, &node->c_node);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy