|
15 | 15 | #include "utils/memutils.h"
|
16 | 16 | #endif
|
17 | 17 |
|
| 18 | +#define GetScanList(ptr) pairingheap_container(IvfflatScanList, ph_node, ptr) |
| 19 | +#define GetScanListConst(ptr) pairingheap_const_container(IvfflatScanList, ph_node, ptr) |
| 20 | + |
18 | 21 | /*
|
19 | 22 | * Compare list distances
|
20 | 23 | */
|
21 | 24 | static int
|
22 | 25 | CompareLists(const pairingheap_node *a, const pairingheap_node *b, void *arg)
|
23 | 26 | {
|
24 |
| - if (((const IvfflatScanList *) a)->distance > ((const IvfflatScanList *) b)->distance) |
| 27 | + if (GetScanListConst(a)->distance > GetScanListConst(b)->distance) |
25 | 28 | return 1;
|
26 | 29 |
|
27 |
| - if (((const IvfflatScanList *) a)->distance < ((const IvfflatScanList *) b)->distance) |
| 30 | + if (GetScanListConst(a)->distance < GetScanListConst(b)->distance) |
28 | 31 | return -1;
|
29 | 32 |
|
30 | 33 | return 0;
|
@@ -76,22 +79,22 @@ GetScanLists(IndexScanDesc scan, Datum value)
|
76 | 79 |
|
77 | 80 | /* Calculate max distance */
|
78 | 81 | if (listCount == so->probes)
|
79 |
| - maxDistance = ((IvfflatScanList *) pairingheap_first(so->listQueue))->distance; |
| 82 | + maxDistance = GetScanList(pairingheap_first(so->listQueue))->distance; |
80 | 83 | }
|
81 | 84 | else if (distance < maxDistance)
|
82 | 85 | {
|
83 | 86 | IvfflatScanList *scanlist;
|
84 | 87 |
|
85 | 88 | /* Remove */
|
86 |
| - scanlist = (IvfflatScanList *) pairingheap_remove_first(so->listQueue); |
| 89 | + scanlist = GetScanList(pairingheap_remove_first(so->listQueue)); |
87 | 90 |
|
88 | 91 | /* Reuse */
|
89 | 92 | scanlist->startPage = list->startPage;
|
90 | 93 | scanlist->distance = distance;
|
91 | 94 | pairingheap_add(so->listQueue, &scanlist->ph_node);
|
92 | 95 |
|
93 | 96 | /* Update max distance */
|
94 |
| - maxDistance = ((IvfflatScanList *) pairingheap_first(so->listQueue))->distance; |
| 97 | + maxDistance = GetScanList(pairingheap_first(so->listQueue))->distance; |
95 | 98 | }
|
96 | 99 | }
|
97 | 100 |
|
@@ -122,7 +125,7 @@ GetScanItems(IndexScanDesc scan, Datum value)
|
122 | 125 | /* Search closest probes lists */
|
123 | 126 | while (!pairingheap_is_empty(so->listQueue))
|
124 | 127 | {
|
125 |
| - BlockNumber searchPage = ((IvfflatScanList *) pairingheap_remove_first(so->listQueue))->startPage; |
| 128 | + BlockNumber searchPage = GetScanList(pairingheap_remove_first(so->listQueue))->startPage; |
126 | 129 |
|
127 | 130 | /* Search all entry pages for list */
|
128 | 131 | while (BlockNumberIsValid(searchPage))
|
|
0 commit comments